Skip to content

HTTP routing

Andrea Mecchia edited this page Jan 27, 2018 · 8 revisions

Index > HTTP routing

Routing

When a visitor makes a request on the website the request is passed to a router that possibly handles the request and sends back a response to the client. This process consists of these steps (using SnooPHP project):

  • incoming request is forwarded to public/index.php
  • the bootstrap.php script is loaded and routers defined in config/* files are registered
  • each router tries to handle the request. A request is matched if a route with the correct method is defined.
  • If a request is matched, the response is parsed
  • Otherwise in no router is able to handle the request the error script (if defined) of the matching router is executed or a generic 404 error is sent to the client

Basic routing >

The Request class >

The Response class >

Clone this wiki locally