As we noted in the previous chapter, our web server acts as a combined front controller, router, and dispatcher for our legacy application. The routes to the page scripts are still mapped directly onto the file system, using our docroot/
directory as the base for all URL paths.
This presents us with some structural problems. For example, if we want to expose a new or different URL, we have to modify the location of the related page script in the file system. Similarly, we cannot change what page script responds to a particular URL. There is no way intercept the incoming request before it is routed.
These and other problems, including the ability to complete future refactorings, mean that we must create a single entry point for all incoming requests. This entry point is called a front controller.
In our first implementation of a front controller for our legacy application, we will add a Router to convert the incoming URL path to a page script path. That will allow us to remove...