aliensdev/ad-router

There is no license information available for the latest version (dev-master) of this package.

dev-master 2020-09-22 15:08 UTC

This package is not auto-updated.

Last update: 2024-04-14 04:04:05 UTC


README

How it Works

  1. Capture the Request
    - $request = ServerRequest::fromGlobals();
    
  2. Instantiate the Router
    - $router = new Router();
    
  3. Add Routes
    - $router->addRoute("GET","/",[HomeController::class, "index"]);
    
  4. get The Correspondent Route
    - $route = $router->match($request);
    
  5. 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!");
     }
    
  6. Send back the response
    - send($response);