One of the most essential parts of any web framework is having a flexible way of converting browser URLs into a definable logic path on the server, and with Phalcon this is achieved with the Phalcon\Mvc\Router
class. To start with, it is necessary to have an understanding of the default routing strategy and then later, this can be expanded upon.
The default routing strategy can be described simply in that each web request is assigned to a Phalcon\Mvc\Controller
class and then to the specific action
function within that controller. So with each URL, we can begin to think about which PHP controller class the request will be directed to and then which action
method within that controller will finally handle the request. In this way, groups of common behavior can be grouped together into a single controller for both reducing duplicate code and for organization. The best part is that right from the start, each new action
function is automatically...