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

Annotaion routes

Here is the error I get when try annotations routes at phalcon : Class IndexController does not exist

    $di['router'] = function () {

    $router = new RouterAnnotations(false); //new Router();
    $router->setUriSource(\Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI);
    $router->setDefaultModule('frontend');
    $router->setDefaultNamespace('Test\Frontend\Controllers');

    $router->addResource('Index');

    return $router;
    };
<?php

namespace Test\Frontend\Controllers;

    /**
    * @RoutePrefix("/")
    */
    class IndexController extends ControllerBase
    {
    /**
     * @Get("/")
     */
    public function indexAction()
    {

    }

    /**
     * @Post("/test")
     */
    public function testAction()
    {
        var_dump('ha');
        exit;
    }
}

try:

    $router->addResource('Test\Frontend\Controllers\Index');

If you want use annotations, have a look https://github.com/wenbinye/PhalconX

https://github.com/wenbinye/admin-gen is an demo project to show how to use the library