We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

About Command Line Applications

I see that phalcon's command line application's params is so weak. Is there any plan to improve that? Just like the style of Yii, Laravel

php yiic mycontroller myaction --name=me --age=12 php artisan command --name=me --age=12

edited Mar '14

You can easily use Symfony\Console with Phalcon. Artisan use Symfony\Console internaly so it will be the same.

#!/usr/bin/env php
<?php
set_time_limit(0);
include_once('vendor/autoload.php');
$di = new \Phalcon\Di\FactoryDefault\CLI();
// here add your DI services ...

$app = new App\Cli($di);
$app->run();

Here is example for App\Cli

namespace App;

class Cli extends \Symfony\Component\Console\Application
{
    public function __construct($di)
    {
        parent::__construct();
        $this->di = $di;

        $this->add(new App\Task\Cache\ClearCommand($this->di->get('config')));
    }
}


3.8k

Thanks, I will have a try.