PHP code example of kaio-souza / php-router

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

    

kaio-souza / php-router example snippets


$router = new Router();

$router->get('/xpto', function(){
    echo 'Hello World';
});

$router->get('/xpto/{param}', function($param){
    echo $param;
});

$router->listen();

try_files $uri /index.php;