1. Go to this page and download the library: Download vertilia/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/ */
vertilia / router example snippets
// public/index.php (v1)
$router = new Vertilia\Router\Router(
new Vertilia\Parser\OpenApiParser(),
[__DIR__ . '/../etc/routes.php']
);
// public/index.php (v2)
$router = new Vertilia\Router\HttpRouter(
new Vertilia\Request\HttpRequest(),
[__DIR__ . '/../etc/routes.php']
);
// www/index.php
FoundController;
use Vertilia\Request\HttpRequest;
use Vertilia\Router\HttpRouter;
// construct route from the request
$request = new HttpRequest(
$_SERVER,
$_GET,
$_POST,
$_COOKIE,
$_FILES,
file_get_contents('php://input')
);
// instantiate HttpRouter without parsing
$router = new HttpRouter($request);
// set pre-compiled routes
$router->setParsedRoutes(