Skip to content

v3.0.1

Compare
Choose a tag to compare
@gigili gigili released this 19 Mar 20:51
· 57 commits to main since this release

Added append method which lets you append routes from another routes handler.

Example:

Create 2 files index.php and api.php

In the api.php:

$apiRoutes = new Routes();
$apiRoutes->prefix("/api")->get("/", function(Request  $request){})->save();

In the index.php:

require_once "api.php";
$routes = new Routes();

try{
  $routes->get("/", function(){})->add();

  if(isset($apiRoutes){
    $routes->append($apiRoutes->get_routes());
  }

  $routes->handle();
}catch(Exception $ex){}