PHP code example of molovo / traffic

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

    

molovo / traffic example snippets


use Molovo\Traffic\Router;

Router::get('/hello', function() {
    echo 'Hello World!';
});

// GET /news/2
Router::get('/news/{page:int}', function($page) {
    echo $page; // 2
});

// POST /user/[email protected]
Router::get('/user/{email:email}', function($email) {
    echo $email; // [email protected]
});

// Call execute once routes have been defined to
// execute the callback for the matching route.
Router::execute();