- Capture the Request
- $request = ServerRequest::fromGlobals();
- Instantiate the Router
- $router = new Router();
- Add Routes
- $router->addRoute("GET","/",[HomeController::class, "index"]);
- get The Correspondent Route
- $route = $router->match($request);
- Generate Response
if(! is_null($route)) { // if route Found ! $response = $router->dispatch($route); }else { // if route isn't found $response = new Response(404,[],"Not Found!"); }
- Send back the response
- send($response);