v3.0.1
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){}