$defaultName
$defaultName : string|null
Base class for Composer commands
$versionParser : \Composer\Package\Version\VersionParser
$composer : \Composer\Composer
$io : \Composer\IO\IOInterface
$hidden :
$pool : \Composer\DependencyResolver\Pool
getComposer(boolean $required = true, boolean|null $disablePlugins = null) : \Composer\Composer
boolean | $required | |
boolean|null | $disablePlugins |
setComposer(\Composer\Composer $composer)
\Composer\Composer | $composer |
getIO() : \Composer\IO\IOInterface
setIO(\Composer\IO\IOInterface $io)
\Composer\IO\IOInterface | $io |
setApplication(\Symfony\Component\Console\Application $application = null)
\Symfony\Component\Console\Application | $application |
setHelperSet(\Symfony\Component\Console\Helper\HelperSet $helperSet)
\Symfony\Component\Console\Helper\HelperSet | $helperSet |
getHelperSet() : \Symfony\Component\Console\Helper\HelperSet
Gets the helper set.
A HelperSet instance
getApplication() : \Symfony\Component\Console\Application
Gets the application instance for this command.
An Application instance
run(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) : integer
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
\Symfony\Component\Console\Input\InputInterface | $input | |
\Symfony\Component\Console\Output\OutputInterface | $output |
When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
The command exit code
setCode(callable $code) : $this
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
callable | $code | A callable(InputInterface $input, OutputInterface $output) |
mergeApplicationDefinition(boolean $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
boolean | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
setDefinition(array|\Symfony\Component\Console\Input\InputDefinition $definition) : $this
Sets an array of argument and option instances.
array|\Symfony\Component\Console\Input\InputDefinition | $definition | An array of argument and option instances or a definition instance |
getDefinition() : \Symfony\Component\Console\Input\InputDefinition
Gets the InputDefinition attached to this Command.
An InputDefinition instance
getNativeDefinition() : \Symfony\Component\Console\Input\InputDefinition
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
An InputDefinition instance
addArgument(string $name, integer|null $mode = null, string $description = '', string|array<mixed,string>|null $default = null) : $this
Adds an argument.
string | $name | The argument name |
integer|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
string | $description | A description text |
string|array<mixed,string>|null | $default | The default value (for self::OPTIONAL mode only) |
When argument mode is not valid
addOption(string $name, string|array $shortcut = null, integer|null $mode = null, string $description = '', string|array<mixed,string>|boolean|null $default = null) : $this
Adds an option.
string | $name | The option name |
string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
integer|null | $mode | The option mode: One of the VALUE_* constants |
string | $description | A description text |
string|array<mixed,string>|boolean|null | $default | The default value (must be null for self::VALUE_NONE) |
If option mode is invalid or incompatible
setName(string $name) : $this
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
$command->setName('foo:bar');
string | $name | The command name |
When the name is invalid
setHidden(boolean $hidden) : \Symfony\Component\Console\Command\Command
boolean | $hidden | Whether or not the command should be hidden from the list of commands |
The current instance
getHelper(string $name) : mixed
Gets a helper instance by name.
string | $name | The helper name |
if no HelperSet is defined
if the helper is not defined
The helper value
initialize(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
\Symfony\Component\Console\Input\InputInterface | $input | |
\Symfony\Component\Console\Output\OutputInterface | $output |
getPreferredInstallOptions(\Composer\Config $config, \Symfony\Component\Console\Input\InputInterface $input, boolean $keepVcsRequiresPreferSource = false) : array<mixed,boolean>
Returns preferSource and preferDist values based on the configuration.
\Composer\Config | $config | |
\Symfony\Component\Console\Input\InputInterface | $input | |
boolean | $keepVcsRequiresPreferSource |
An array composed of the preferSource and preferDist values
execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
\Symfony\Component\Console\Input\InputInterface | $input | |
\Symfony\Component\Console\Output\OutputInterface | $output |
interact(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
\Symfony\Component\Console\Input\InputInterface | $input | |
\Symfony\Component\Console\Output\OutputInterface | $output |
getVersionStyle(\Composer\Package\PackageInterface $latestPackage, \Composer\Package\PackageInterface $package)
\Composer\Package\PackageInterface | $latestPackage | |
\Composer\Package\PackageInterface | $package |
getPackage(\Composer\Repository\RepositoryInterface $installedRepo, \Composer\Repository\RepositoryInterface $repos, string $name, \Composer\Semver\Constraint\ConstraintInterface|string $version = null) : array
finds a package by name and version if provided
\Composer\Repository\RepositoryInterface | $installedRepo | |
\Composer\Repository\RepositoryInterface | $repos | |
string | $name | |
\Composer\Semver\Constraint\ConstraintInterface|string | $version |
array(CompletePackageInterface, array of versions)
printMeta(\Composer\Package\CompletePackageInterface $package, array $versions, \Composer\Repository\RepositoryInterface $installedRepo, \Composer\Package\PackageInterface $latestPackage = null)
Prints package metadata.
\Composer\Package\CompletePackageInterface | $package | |
array | $versions | |
\Composer\Repository\RepositoryInterface | $installedRepo | |
\Composer\Package\PackageInterface | $latestPackage |
printVersions(\Composer\Package\CompletePackageInterface $package, array $versions, \Composer\Repository\RepositoryInterface $installedRepo)
Prints all available versions of this package and highlights the installed one if any.
\Composer\Package\CompletePackageInterface | $package | |
array | $versions | |
\Composer\Repository\RepositoryInterface | $installedRepo |
printLinks(\Composer\Package\CompletePackageInterface $package, string $linkType, string $title = null)
print link objects
\Composer\Package\CompletePackageInterface | $package | |
string | $linkType | |
string | $title |
printLicenses(\Composer\Package\CompletePackageInterface $package)
Prints the licenses of a package with metadata
\Composer\Package\CompletePackageInterface | $package |
initStyles(\Symfony\Component\Console\Output\OutputInterface $output)
Init styles for tree
\Symfony\Component\Console\Output\OutputInterface | $output |
generatePackageTree(\Composer\Package\PackageInterface|string $package, \Composer\Repository\RepositoryInterface $installedRepo, \Composer\Repository\RepositoryInterface $distantRepos) : array
Generate the package tree
\Composer\Package\PackageInterface|string | $package | |
\Composer\Repository\RepositoryInterface | $installedRepo | |
\Composer\Repository\RepositoryInterface | $distantRepos |
displayTree(\Composer\Package\PackageInterface|string $package, array $packagesInTree, string $previousTreeBar = '├', integer $level = 1)
Display a package tree
\Composer\Package\PackageInterface|string | $package | |
array | $packagesInTree | |
string | $previousTreeBar | |
integer | $level |
addTree(string $name, \Composer\Package\PackageInterface|string $package, \Composer\Repository\RepositoryInterface $installedRepo, \Composer\Repository\RepositoryInterface $distantRepos, array $packagesInTree) : array
Display a package tree
string | $name | |
\Composer\Package\PackageInterface|string | $package | |
\Composer\Repository\RepositoryInterface | $installedRepo | |
\Composer\Repository\RepositoryInterface | $distantRepos | |
array | $packagesInTree |
validateName(\Symfony\Component\Console\Command\string $name)
Validates a command name.
It must be non-empty and parts can optionally be separated by ":".
\Symfony\Component\Console\Command\string | $name |
When the name is invalid
getUpdateStatus(\Composer\Package\PackageInterface $latestPackage, \Composer\Package\PackageInterface $package)
\Composer\Package\PackageInterface | $latestPackage | |
\Composer\Package\PackageInterface | $package |
findLatestPackage(\Composer\Package\PackageInterface $package, \Composer\Composer $composer, string $phpVersion, boolean $minorOnly = false) : \Composer\Package\PackageInterface|null
Given a package, this finds the latest package matching it
\Composer\Package\PackageInterface | $package | |
\Composer\Composer | $composer | |
string | $phpVersion | |
boolean | $minorOnly |
getPool(\Composer\Composer $composer)
\Composer\Composer | $composer |