1. Go to this page and download the library: Download plugowski/php_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/ */
plugowski / php_router example snippets
PhpRouter\Route;
use PhpRouter\RouteCollection;
use PhpRouter\Router;
use PhpRouter\RouteRequest;
$routing = new RouteCollection();
$routing->attach(new Route('GET /', function(){
echo 'Hello World';
}));
(new Router(new RouteRequest(), $routing))->run();
new Route('GET /', '\Full\Namespace\Class->method');
new Route('GET /order/@id', '\Full\Namespace\Class->method');