dev-master
9999999-devA console provider for the Silex micro-framework
MIT
The Requires
console silex cli
A console provider for the Silex micro-framework
An instance of SilexCLI\Console (which extends Symfony\Component\Console\Application)., (*1)
An instance of Symfony\Component\Console\Input\ArgvInput, accessible to command callbacks., (*2)
An instance of Symfony\Component\Console\Output\ConsoleOutput, accessible to command callbacks., (*3)
Contains the exit code of the last console execution., (*4)
use SilexCLI\Provider\ConsoleServiceProvider; $app->register(new ConsoleServiceProvider());
Commands can be registered with the console's route method. The route pattern is used to identify arguments, and dependency injection is used to identify argument defaults and options., (*5)
If a callback parameter is present in the route pattern, it is defined as an argument. Parameters not present in the route pattern are, (*6)
If a callback parameter is present in the route pattern, it is defined as an argument. If it has a default value, then it will not be required by the console., (*7)
$app['console']->match('example {arg1}', function($arg1) use ($app) { ... });
Callback parameters not present in the route pattern will be added to the command definition as options. All options must have a default value., (*8)
$app['console']->match('example', function($opt1 = 'default') use ($app) { ... });
If the option default is a boolean value, it will be treated as a flag., (*9)
$app['console']->match('example', function($flag1 = false) use ($app) { ... });
Arguments and options can accept array values as well (though only the last argument may be an array)., (*10)
$app['console']->match('example {array-arg}', function(array $array_arg, array $array_opt = array()) use ($app) { ... });
SilexCLI\Application\ConsoleTrait adds the following shortcuts:, (*11)
Adds a new command to the console and returns it., (*12)
$app->command($pattern, $callback);
A console provider for the Silex micro-framework
MIT
console silex cli