for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Install composer.
*
* @link https://github.com/maab16
* @since 1.0.0
*/
* Register all actions and filters for the plugin.
* Maintain a list of all hooks that are registered throughout
* the plugin, and register them with the WordPress API. Call the
* run function to execute the list of actions and filters.
* @author Md Abu Ahsan basir <[email protected]>
class InstallComposer
{
* Install composer factory.
public function __construct()
if (!file_exists(__DIR__.'/../vendor/autoload.php')) {
require_once __DIR__.'/../vendor/autoload.php';
$composer = 'composer';
try {
$process = \Symfony\Component\Process\Process::fromShellCommandline($composer.' install');
$process->setEnv(
[
'COMPOSER_HOME' => __DIR__.'/../vendor/bin/composer',
]
);
$process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time.
$process->setWorkingDirectory(__DIR__)->mustRun();
} catch (\Exception $ex) {
echo $ex->getMessage();
}