1. Go to this page and download the library: Download math280h/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/ */
math280h / php-router example snippets
use Math280h\PhpRouter\Router;
use Math280h\PhpRouter\Request;
session_start();
$router = new Router("./public");
$router->get('/', function () {
echo 'Hello World';
});
$router->post('/', function (Request $request) {
echo 'Hello World';
});
$router->run();