Whilst there appears to be many different ways of routing web requests to code within web applications, they
can all be grouped into two camps: page controllers and front controllers. A page controller uses separate files
for every page (or group of pages) that make up the website and is traditionally how most PHP websites have
been built. This means that the control of the application is decentralized across lots of different files which
can result in repeated code, or worse, repeated and slightly altered code leading to issues such as lost sessions
when one of the files doesn’t do a session_start().
A front controller, on the other hand, centralizes all web requests into a single file, typically called
index.php, which lives in the root directory of the website. There are numerous advantages to this system; the
most obvious are that there is less duplicated code and that it is easier to separate the URLs that a website has
from the actual code that is used to generate the pages. Usually, the pages are displayed using two additional
GET parameters passed to the index.php file to create URLs such as index.php?controller=news&action=list to
display a list page.
If we recap from chapter 1, Figure 2.4 shows the Zend Framework classes that implement the MVC design
pattern. There are three separate components used and within each component, more than one class is required
for the application.
