Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CreateProjectCommand.php

function CreateProjectCommand::execute

Overrides Command::execute

File

vendor/composer/composer/src/Composer/Command/CreateProjectCommand.php, line 129

Class

CreateProjectCommand
Install a package as new project into new directory.

Namespace

Composer\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) : int {
    $config = Factory::createConfig();
    $io = $this->getIO();
    [
        $preferSource,
        $preferDist,
    ] = $this->getPreferredInstallOptions($config, $input, true);
    if ($input->getOption('dev')) {
        $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
    }
    if ($input->getOption('no-custom-installers')) {
        $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
        $input->setOption('no-plugins', true);
    }
    if ($input->isInteractive() && $input->getOption('ask')) {
        $package = $input->getArgument('package');
        if (null === $package) {
            throw new \RuntimeException('Not enough arguments (missing: "package").');
        }
        $parts = explode("/", strtolower($package), 2);
        $input->setArgument('directory', $io->ask('New project directory [<comment>' . array_pop($parts) . '</comment>]: '));
    }
    return $this->installProject($io, $config, $input, $input->getArgument('package'), $input->getArgument('directory'), $input->getArgument('version'), $input->getOption('stability'), $preferSource, $preferDist, !$input->getOption('no-dev'), \count($input->getOption('repository')) > 0 ? $input->getOption('repository') : $input->getOption('repository-url'), $input->getOption('no-plugins'), $input->getOption('no-scripts'), $input->getOption('no-progress'), $input->getOption('no-install'), $this->getPlatformRequirementFilter($input), !$input->getOption('no-secure-http'), $input->getOption('add-repository'));
}
RSS feed
Powered by Drupal