PHP code example of sugatasei / bredala-router

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

    

sugatasei / bredala-router example snippets


use Bredala\Router\Router;

$router = new Router();
$router->add('GET', '/', function() {
    echo 'home';
});

$router->add('GET', '/hello/([^/]+)', function(string $world) {
    echo "Hello {$world}!";
});