mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Add cli argument for classmap-authoritative
Add a `--classmap-authoritative (-a)` argument to `composer install`, `composer update` and `composer dumpautoload`. This enables the same authoritative classmap behavior as the existing `classmap-authoritative` configuration setting. The option can be used for creating highly optimized production autoloaders via `composer install --no-dev --optimize-autoloader --classmap-authoritative` for projects where multiple autoloaders are present and unnecessary `file_exists` calls introduce performance issues. Closes #4361
This commit is contained in:
parent
d831c86bcb
commit
cc2b9cfca5
9 changed files with 96 additions and 23 deletions
|
@ -46,6 +46,7 @@ class InstallCommand extends Command
|
|||
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
|
||||
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
|
||||
new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
|
||||
new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
|
||||
new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
|
||||
new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
|
||||
))
|
||||
|
@ -110,7 +111,8 @@ EOT
|
|||
$preferDist = $input->getOption('prefer-dist');
|
||||
}
|
||||
|
||||
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader') || $config->get('classmap-authoritative');
|
||||
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
|
||||
$authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
|
||||
|
||||
$install
|
||||
->setDryRun($input->getOption('dry-run'))
|
||||
|
@ -121,6 +123,7 @@ EOT
|
|||
->setDumpAutoloader(!$input->getOption('no-autoloader'))
|
||||
->setRunScripts(!$input->getOption('no-scripts'))
|
||||
->setOptimizeAutoloader($optimize)
|
||||
->setClassMapAuthoritative($authoritative)
|
||||
->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
|
||||
;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue