The request life cycle in the Laminas MVC
At this moment, you can quickly launch the whatstore application and see the home page with the embedded web server for PHP. From the whatstore
directory, you can type the following command:
php -S localhost:8000 -t public/
When you open localhost:8000
in your browser, you will see the same welcome page that you will have seen in Chapter 2, Setting Up the Environment for Our E-Commerce Application. Of course, we haven’t changed any view yet.
In Chapter 5, Creating the Virtual Store Project, we learned a little about the public
directory. We learned that the structure of an MVC Laminas application is like that of a medieval castle, where the only way to enter is over the drawbridge. The drawbridge here is the public
directory. All HTTP requests are passed to the index.php
file inside the public
directory. So, what does index.php
do? It does this:
- Imports the
autoload.php
Composer file. - Checks whether the Laminas
Application...