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

Namespaces for Controller

Can I use Namespace directory for my contollers? If i try, I get error "Namespace/controllerController handler class cannot be loaded"

In router I wrote: $router->add('/uri/', 'namespace/controller::index');



32.5k

Don't you see the difference between strings Phalcon\Config\Adapter\Ini and Namespace/Controller ?



98.9k

It's better use the array syntax here:

$router->add('/uri/', array(
     'namespace' => 'Namespace\Subnamespace',
     'controller' => 'some-controller'
));