1. Go to this page and download the library: Download lukman-ss/router library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lukman-ss / router example snippets
declare(strict_types=1);
use Lukman\Http\Request;
use Lukman\Http\Response;
use Lukman\Router\Router;
$router = new Router();
$router->get('/users/{id}', function (Request $request, string $id): Response {
return new Response('User ' . $id);
})->where('id', '[0-9]+')->name('users.show');
$response = $router->dispatch(new Request('GET', '/users/42'));
echo $response->content();