Phalcon\Mvc\Router is the standard framework router. Routing is the process of taking a URI endpoint (that part of the URI which comes after the base URL) and decomposing it into parameters to determine which module, controller, and action of that controller should receive the request
Phalcon\Cli\Router is the standard framework router. Routing is the process of taking a command-line arguments and decomposing it into parameters to determine which module, task, and action of that task should receive the request.
Configurations
# mvc default routesROUTER_DEFAULT_NAMESPACE=Zemit\Modules\Frontend\ControllersROUTER_DEFAULT_MODULE=frontendROUTER_DEFAULT_CONTROLLER=indexROUTER_DEFAULT_ACTION=index# cli default routesROUTER_CLI_DEFAULT_NAMESPACE=Zemit\Modules\Cli\TasksROUTER_CLI_DEFAULT_MODULE=cliROUTER_CLI_DEFAULT_TASK=helpROUTER_CLI_DEFAULT_ACTION=main# not-foundROUTER_NOTFOUND_NAMESPACE=ROUTER_NOTFOUND_MODULE=ROUTER_NOTFOUND_CONTROLLER=errorROUTER_NOTFOUND_TASK=errorROUTER_NOTFOUND_ACTION=notFound# fatalROUTER_FATAL_NAMESPACE=ROUTER_FATAL_MODULE=ROUTER_FATAL_CONTROLLER=errorROUTER_FATAL_TASK=errorROUTER_FATAL_ACTION=fatal# forbiddenROUTER_FORBIDDEN_NAMESPACE=ROUTER_FORBIDDEN_MODULE=ROUTER_FORBIDDEN_CONTROLLER=errorROUTER_FORBIDDEN_TASK=errorROUTER_FORBIDDEN_ACTION=forbidden# unauthorizedROUTER_UNAUTHORIZED_NAMESPACE=ROUTER_UNAUTHORIZED_MODULE=ROUTER_UNAUTHORIZED_CONTROLLER=errorROUTER_UNAUTHORIZED_TASK=errorROUTER_UNAUTHORIZED_ACTION=unauthorized# default maintenanceROUTER_MAINTENANCE_NAMESPACE=ROUTER_MAINTENANCE_MODULE=ROUTER_MAINTENANCE_CONTROLLER=errorROUTER_MAINTENANCE_TASK=errorROUTER_MAINTENANCE_ACTION=maintenance# errorROUTER_ERROR_NAMESPACE=ROUTER_ERROR_MODULE=ROUTER_ERROR_CONTROLLER=errorROUTER_ERROR_TASK=errorROUTER_ERROR_ACTION=index# define your own service providerPROVIDER_ROUTER=\Zemit\Provider\Router\ServiceProvider
Usage
// if the class is aware of injections$router =$this->router;// if the container is present$router =$this->di->get('router');// from outside$router =Di::getDefault()->get('router');