Console
class Console (View source)
Constants
| REGEX_PARSE_OPTION |
|
Properties
| protected | $namespacePrefix |
Methods
Register callable, console controller, and Command instance for a CLI command
Prefixes the namespace to command controller classes
Receives the arguments to execute the command If the command is not found, an exception will be thrown
Get a command by name
Shortcut to execute predefined commands or commands from system/console.php
Parse the arguments (usually received from the $argv variable) into an associative array, based on the long and short format options.
Details
Command
action(string $name, string|callable $callback)
Register callable, console controller, and Command instance for a CLI command
setNamespace(string $prefix)
Prefixes the namespace to command controller classes
int
exec(array $arguments)
Receives the arguments to execute the command If the command is not found, an exception will be thrown
Command|null
getCommand(string $name)
Get a command by name
static string
run(string $command, array $args = array(), int $code = 0)
Shortcut to execute predefined commands or commands from system/console.php
static protected array<string, string>
parseOptions(array $entries)
Parse the arguments (usually received from the $argv variable) into an associative array, based on the long and short format options.
Note: It is possible to extend the Console class by creating a subclass that overrides the parser, allowing it to use a different options structure.