We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 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!



43.9k

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.



2.7k

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