Being able to easily assign URL paths to server side controller logic is a powerful capability. To improve on this, we will be introducing the ability to have requests forwarded from one controller to another controller. This framework design is known as HMVC (Hierarchical Model View Controller), and this recipe will demonstrate how to work with the Hierarchical part of Phalcon controllers.
To use this recipe, you will need to have a project skeleton with a configured Phalcon bootstrapper, Phalcon\Mvc\Router
, and three Phalcon\Mvc\Controller
. In our example, we will use a project scaffold generated by Phalcon Developer Tools.
To test the recipe results, you need to have a web server installed and configured for handling requests to your application. Your application must be able to take requests, and additionally, there must be such necessary components as controllers, views, and a bootstrap
file.
A database is not required for this...