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

Create custom devtool command

Lavael's artisan allows users to add custom commands, is there a similar mechanism in Phalcon's devtools?

<?php namespace App\Artisan;

use Illuminate\Console\Command;

class MyCommand extends Command {
    protected $name = 'mypackage:mycommand';
    protected $description = 'Nice description of my command.';
    public function fire()
        /// do stuff

edited Mar '16

Yes there is. Look on it:


If you want add command just only for your project then create Command in your project and autoload.php(to load additional classes like builders etc) + phalcon.ini(with directory where you store your commands) in .phalcon folder inside your project to load this command.

But unfortunately i don't see this command load anywhere:


Or maybe im blind.

I guess if it's not running you just have to add in phalcon.php $script->loadUserScripts();

If you want add some command globally to devtools then add them inside devtools to Phalcon/Commands/Builtin and add after here : https://github.com/phalcon/phalcon-devtools/blob/master/phalcon.php#L79

Also are you sure you want to add new command to devtool ? Beacause if you want some command to runned for example as a cron then you should use whole diffrent approach: