CommandRegistry
final class CommandRegistry (View source)
Registers command metadata and resolves command names and aliases for execution.
Methods
Creates a registry that resolves command implementations through the container.
Registers a legacy command whose metadata must be read from an instance.
Registers command metadata and all aliases as one atomic namespace entry.
Reports whether a primary command name or alias is registered.
Resolves a registered command implementation by primary name or alias.
Returns command metadata by primary name or alias without instantiating the command.
Returns all definitions sorted by their primary command name.
Resolves all registered commands in primary-name order.
Details
__construct
__construct(ContainerInterface $container)
Creates a registry that resolves command implementations through the container.
register
void
register(string|CommandInterface $command)
Registers a legacy command whose metadata must be read from an instance.
New code should register a definition so listing commands remains lazy.
registerDefinition
void
registerDefinition(CommandDefinition $definition)
Registers command metadata and all aliases as one atomic namespace entry.
has
bool
has(string $name)
Reports whether a primary command name or alias is registered.
get
CommandInterface
get(string $name)
Resolves a registered command implementation by primary name or alias.
This legacy lookup resolves through the root container; normal execution should use the CLI kernel.
definition
CommandDefinition
definition(string $name)
Returns command metadata by primary name or alias without instantiating the command.
allDefinitions
array
allDefinitions()
Returns all definitions sorted by their primary command name.
all
array
all()
Resolves all registered commands in primary-name order.