SymfonyConsoleModule
Symfony Console Module for Zend Framework. Note that this is a full replacement for the Zend Console so your zend commands will not work any longer., (*1)
See Symfony Console on how to write commands., (*2)
Installation
Installation of DoctrineModule uses composer. For composer documentation, please refer to
getcomposer.org., (*3)
cd my/project/directory
-
create or modify the composer.json
file within your ZF2 application file with
following contents:, (*4)
json
{
"require": {
"wfk/symfony-console-module": "*"
}
}
, (*5)
- install composer via
curl -s https://getcomposer.org/installer | php
(on windows, download
https://getcomposer.org/installer and execute it with PHP). Then run php composer.phar install
-
open my/project/directory/configs/application.config.php
and add the following key to your modules
:, (*6)
php
'SymfonyConsoleModule',
, (*7)
Register commands
All commands registered in config[console][commands] get pulled from the service locator and placed in the Symfony console application., (*8)
<?php
return array(
'console' => array(
'commands' => array(
'MyService\LocatorAlias\ToCommand'
)
)
);
Running commands
To run your console app simply run index.php. From your project root:, (*9)
php public/index.php <arguments>
, (*10)
The following extra configurations are optional for the Symfony console application., (*11)
<?php
return array(
'console' => array(
'name' => 'Some console title',
'version' => 'Some console version',
'commands' => array(
// ...
),
)
);