We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How to run a cmd on a php file inside Phalcon

For example: i have a php file that contains the following code

namespace Res\Helper
use Engine\Helper;

class MyClass extends Helper
   public function __construct()

   public function testme()
      return 'WORKS';

When i run in cmd php MyClass.php it says that the class Engine is not found!


Well, this is not so mysterious: how will php knows anything about Engine\Helper ???

More generally, phalcon run as a framework, wich has to be instanciated before running any action => what you're trying to do will never work

You should have a look at https://docs.phalcon.io/en/latest/reference/cli.html for command line task with phalcon.


Well i've tried that code it doesn't work ...i use phalconeye