class ComposerRunner
Runs Composer through the current PHP interpreter.
@internal This is an internal part of Package Manager and may be changed or removed at any time without warning. External code should not interact with this class.
Hierarchy
- class \Drupal\package_manager\ComposerRunner extends \PhpTuf\ComposerStager\API\Process\Service\ComposerProcessRunnerInterface
Expanded class hierarchy of ComposerRunner
1 file declares its use of ComposerRunner
- ComposerRunnerTest.php in core/
modules/ package_manager/ tests/ src/ Unit/ ComposerRunnerTest.php
1 string reference to 'ComposerRunner'
- package_manager.services.yml in core/
modules/ package_manager/ package_manager.services.yml - core/modules/package_manager/package_manager.services.yml
1 service uses ComposerRunner
File
-
core/
modules/ package_manager/ src/ ComposerRunner.php, line 27
Namespace
Drupal\package_managerView source
final class ComposerRunner implements ComposerProcessRunnerInterface {
public function __construct(private readonly ExecutableFinderInterface $executableFinder, private readonly ProcessFactoryInterface $processFactory, private readonly FileSystemInterface $fileSystem, private readonly ConfigFactoryInterface $configFactory) {
}
/**
* {@inheritdoc}
*/
public function run(array $command, ?PathInterface $cwd = NULL, array $env = [], ?OutputCallbackInterface $callback = NULL, int $timeout = ProcessInterface::DEFAULT_TIMEOUT) : void {
// Run Composer through the PHP interpreter so we don't have to rely on
// PHP being in the PATH.
array_unshift($command, (new PhpExecutableFinder())->find(), $this->executableFinder
->find('composer'));
$home = $this->fileSystem
->getTempDirectory();
$home .= '/package_manager_composer_home-';
$home .= $this->configFactory
->get('system.site')
->get('uuid');
$this->fileSystem
->prepareDirectory($home, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
$process = $this->processFactory
->create($command, $cwd, $env + [
'COMPOSER_HOME' => $home,
]);
$process->setTimeout($timeout);
$process->mustRun($callback);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ComposerRunner::run | public | function | |
ComposerRunner::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.