CHAPTER 7
Routing
Routing is what happens when an application determines which controllers and actions are executed based on the URL requested. Simply put, it is how the framework gets from http://localhost/users/list.html
to the Users
controller and the list()
action.
Goals
- We need to understand what routes are and how they work.
- We need to build the different kinds of routes.
- We need to build the
Router
class that will manage these routes.
Defining Routes
Some routes can be inferred from the structure of the application. If the Router
class sees that you have an Articles
controller with a search()
method, if can sometimes assume that the ...
Get Pro PHP MVC now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.