PHP code example of splashsky / simplerouter

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

    

splashsky / simplerouter example snippets


// Include the class... (this can also be done via autoloading)
t GET route...
Router::get('/user/{id}/edit', function ($id) {
    return 'Edit user with id '.$id.'<br>';
});

// Run the router!
Router::run();

Router::run('/api/v1');
bash
composer