Hi. I had a problem with creating CLI app. As I know now we need to pass array with parameters to Phalcon\CLI\Console::handle. So is there a reason to keep Phalcon\CLI\Router? For example:
<?php
$router = new \Phalcon\CLI\Router();
$router->handle($argv);
var_dump($router->getModuleName());
var_dump($router->getTaskName());
var_dump($router->getActionName());
var_dump($router->getParams());
When I run cli command:
php cli.php param1 param2 param3 param4
I get:
NULL
NULL
NULL
array(5) {
[0]=>
string(7) "cli.php"
[1]=>
string(6) "param1"
[2]=>
string(6) "param2"
[3]=>
string(6) "param3"
[4]=>
string(6) "param4"
}
So router does not work (as I expected). But when I try to create Phalcon\CLI\Console with default DI (Phalcon\DI) exception occurs that I didn't set default router service. It depends on router, but router does not work properly.
It is great that we have flexibility to implement own cli argument parsers and using different cli syntax:
php cli.php taskname actionname param1
or
php cli.php task:sometask action:someaction param2
or
php.cli --action=anotheraction
But currently its now working or am I missing something :)