Table Of Contents

Previous topic

< Class Phalcon\Assets\Resource\Js

Next topic

Class Phalcon\CLI\Console\Exception >

Class Phalcon\CLI\Console

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

This component allows to create CLI applications using Phalcon


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


    '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


    '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')