1. Go to this page and download the library: Download tyler/ruta 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/ */
tyler / ruta example snippets
$r = new Ruta\Router;
$r->get('/test/:id', fn() => 'test');
$r->post('/test/:id', fn() => 'test');
$r->delete('/test/:id', fn() => 'test');
$match = $r->dispatch(new ServerRequest('GET', '/test/1'));
// The mapped callable/class to handle the route
$handler = $match->getHandler();
// If a dynamic route those values are stored here
$attrs = $match->getAttributes();