PHP code example of simonhamp / routes

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

    

simonhamp / routes example snippets




imonHamp\Routes;

Routes::add(array(
    'testing/(:num)' => 'test/$1',
    'posts/(:any)'   => 'news/$1'
));

$origin = 'testing/1';

echo Routes::route($origin);
// -> 'test/1'