PHP code example of reneknox / router

1. Go to this page and download the library: Download reneknox/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/ */

    

reneknox / router example snippets



use Reneknox\Router\Router;
use Reneknox\Router\Route;

Route::get('/start', fn() => 'start');

Route::get('/home', function () {
    return 'Home';
});

$router = new Router();

$router->serve($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);