Routing in PHP

Learn how to make a single script that serves all the URL endpoints in our application.

Why routing

As we already know, we should handle our application’s HTTP requests in a single script. At the same time, we want our application to provide different resources depending on the URL. For this, we need a router, a module that parses the request and determines which piece of code should handle it based on the predefined ...