yakisova41 / routing
4.0.3
2022-07-13 16:31 UTC
Requires
- php: >= 8.1.0
- yakisova41/moduleloader: ^1.0
README
About
A composer package that allows you to set up simple routing
Usage
composer require yakisova41/routing
use Yakisova41\Routing\Routing; use Yakisova41\Routing\Route; Route::put('/',['GET'],function(){ echo 'Hello world!!'; }); Routing::listen();
Set path parameters
Route::put('/page/{Pageid}',['GET'],function($req){ echo $req['parameters']['Pageid']; });
Executing this code will display the value specified in the path parameter Pageid
Specify request method
Route::put('/',['POST'],function(){ echo 'Hello world!!'; }); Route::put('/',['GET', 'POST'],function(){ echo 'Hello world!!'; });
Multiple request methods can be specified in the array