PHP code example of adrianschubek / router

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

    

adrianschubek / router example snippets


use adrianschubek\Routing\Route;
use adrianschubek\Routing\Router;

$r = new Router();

$r->get("/", function () {
    echo "Hello stranger!";
});

$r->get("/[a]/[b]", function ($a, $b) {
    echo $a + $b;
})->where("([0-9]+)");

$r->dispatch();