class Console (View source)

Constants

LAST_OPTION_REGEX

Properties

protected $namespacePrefix

Methods

action(string $name, string|callable|Command $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

static string
run(string $command, array $args = array(), int $code = 0)

Shortcut to execute predefined commands or commands from system/console.php

Details

Command action(string $name, string|callable|Command $callback)

Register callable, console controller, and Command instance for a CLI command

Parameters

string $name
string|callable|Command $callback

Return Value

Command

setNamespace(string $prefix)

Prefixes the namespace to command controller classes

Parameters

string $prefix

int exec(array $arguments)

Receives the arguments to execute the command If the command is not found, an exception will be thrown

Parameters

array $arguments

Define $argv without changes

Return Value

int

Exceptions

Exception

static string run(string $command, array $args = array(), int $code = 0)

Shortcut to execute predefined commands or commands from system/console.php

Parameters

string $command

The command that will be executed

array $args

Argument list

int $code

If the $code argument is present, then the return status of the executed command will be written to this variable

Return Value

string

Exceptions

Exception