Documentation

內容目录

上一个主题

< Class Phalcon\Cache\Multiple

下一个主题

Class Phalcon\Cli\Console\Exception >

本页

Class Phalcon\Cli\Console

implements Phalcon\Di\InjectionAwareInterface, Phalcon\Events\EventsAwareInterface

Source on GitHub

This component allows to create CLI applications using Phalcon

Methods

public __construct ([Phalcon\DiInterface $dependencyInjector])

Phalcon\Cli\Console constructor

public setDI (Phalcon\DiInterface $dependencyInjector)

Sets the DependencyInjector container

public getDI ()

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager)

Sets the events manager

public getEventsManager ()

Returns the internal event manager

public registerModules (array $modules)

Register an array of modules present in the console

<?php

$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

<?php

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

public getModules ()

Return the modules registered in the console

public handle ([array $arguments])

Handle the whole command-line tasks

public setArgument ([array $arguments], [unknown $str], [unknown $shift])

Set an specific argument

Follow along: