public function phpComposer(array $composer_command, $opts = [
        'remote-binary-path' => 'composer',
        'remote-working-dir' => '/var/www/html',
    ])
    {
        /** @var DrupalProjectType $project */
        $instance = $this->getProjectInstance();

        $engine = ProjectX::getEngineType();
        $binary = $opts['remote-binary-path'];
        $command_str = escapeshellcmd(implode(' ', $composer_command));
        $working_dir = escapeshellarg($opts['remote-working-dir']);

        $command = $this->taskExec("{$binary} --working-dir={$working_dir} {$command_str}");

        if ($engine instanceof DockerEngineType) {
            $container = $instance->getPhpServiceName('php');
            $result = $this->taskDockerComposeExecute()
                ->setContainer($container)
                ->exec($command)
                ->run();
        } else {
            $result = $command->run();
        }
        $this->validateTaskResult($result);

        return $this;
    }
public function phpComposer(array $composer_command, $opts = [
        'remote-binary-path' => 'composer',
        'remote-working-dir' => '/var/www/html',
    ])
    {
        /** @var DrupalProjectType $project */
        $instance = $this->getProjectInstance();

        $engine = ProjectX::getEngineType();
        $binary = $opts['remote-binary-path'];
        $command_str = escapeshellcmd(implode(' ', $composer_command));
        $working_dir = escapeshellarg($opts['remote-working-dir']);

        $command = $this->taskExec("{$binary} --working-dir={$working_dir} {$command_str}");

        if ($engine instanceof DockerEngineType) {
            $container = $instance->getPhpServiceName('php');
            $result = $this->taskDockerComposeExecute()
                ->setContainer($container)
                ->exec($command)
                ->run();
        } else {
            $result = $command->run();
        }
        $this->validateTaskResult($result);

        return $this;
    }
public function phpComposer ( array $ composer_command , $ opts = [ 'remote-binary-path' => 'composer' , 'remote-working-dir' => '/var/www/html' , ] ) { /** @var DrupalProjectType $project */ $ instance = $ this -> getProjectInstance ( ) ; $ engine = ProjectX :: getEngineType ( ) ; $ binary = $ opts [ 'remote-binary-path' ] ; $ command_str = escapeshellcmd ( implode ( ' ' , $ composer_command ) ) ; $ working_dir = escapeshellarg ( $ opts [ 'remote-working-dir' ] ) ; $ command = $ this -> taskExec ( "{$binary} --working-dir={$working_dir} {$command_str}" ) ; if ( $ engine instanceof DockerEngineType ) { $ container = $ instance -> getPhpServiceName ( 'php' ) ; $ result = $ this -> taskDockerComposeExecute ( ) -> setContainer ( $ container ) -> exec ( $ command ) -> run ( ) ; } else { $ result = $ command -> run ( ) ; } $ this -> validateTaskResult ( $ result ) ; return $ this ; }
Php composer command.

@aliases composer

@param array $composer_command The composer command to execute.
@param array $opts
@option string $remote-binary-path The path to the Drush binary.
@option string $remote-working-dir The remote Drupal root directory.

@return $this
@throws \Exception
@throws \Psr\Container\ContainerExceptionInterface
@throws \Psr\Container\NotFoundExceptionInterface
Php composer command .