Class Phalcon\CLI\Console

implements Phalcon\DI\InjectionAwareInterface, Phalcon\Events\EventsAwareInterface

This component allows to create CLI applications using Phalcon

Methods

public __construct ([unknown $dependencyInjector])

Phalcon\CLI\Console constructor

public setDI (Phalcon\DiInterface $dependencyInjector)

Sets the DependencyInjector container

public Phalcon\DiInterface getDI ()

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager)

Sets the events manager

public Phalcon\Events\ManagerInterface getEventsManager ()

Returns the internal event manager

public registerModules (array $modules)

Register an array of modules present in the console

$application->registerModules(array(
    'frontend' => array(
            'className' => 'Multiple\Frontend\Module',
            'path' => '../apps/frontend/Module.php'
    ),
    'backend' => array(
            'className' => 'Multiple\Backend\Module',
            'path' => '../apps/backend/Module.php'
    )
));

public addModules (array $modules)

Merge modules with the existing ones

$application->addModules(array(
    'admin' => array(
            'className' => 'Multiple\Admin\Module',
            'path' => '../apps/admin/Module.php'
    )
));

public array getModules ()

Return the modules registered in the console

public mixed handle ([array $arguments])

Handle the command-line arguments.

$arguments = array(
            'task' => 'taskname',
            'action' => 'action',
            'params' => array('parameter1', 'parameter2')
    );
    $console->handle($arguments);

© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_CLI_Console.html