$phpFinder = new PhpExecutableFinder();
if($phpBin = $phpFinder->find()) {
// Removing composer dev packages'
$cmdLine = "$phpBin ".base_path('lib/composer/composer.phar').' install --no-dev';
$process = new Process(str_replace('\\','/',$cmdLine),base_path($this->getDistPath()));
$process->setTimeout(0);
$process->mustRun(function($type,$line){
// get output if needed
});
}
For clarity we distribute the composer.phar in our application so we don't depend on a global composer install, the path is reachable within project base folder
I think your solution is best however I can't run it. I don't know what this is: base_path($this->getDistPath())
This is my code
$cmdLine = "$phpBin ".base_path('composer.phar').' update --no-progress --no-scripts';
$process = new Process([str_replace('\','/',$cmdLine), base_path()]);
$process->setTimeout(0);
$process->mustRun();
but it's error:
Error Output:
The filename, directory name, or volume label syntax is incorrect.