PHP code example of agregalel / router-php

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

    

agregalel / router-php example snippets


use agregalel\router_php\Route;
use controllers\TestController;

('', [new TestController(), 'index']);

Route::get('param_request_example/{:id}', [new TestController(), 'paramRequestExample']);

Route::get('form_example', [new TestController(), 'formExample']);

Route::post('post_example', [new TestController(), 'postExample']);

Route::get('404', [new TestController(), 'error']);

/**
 * Init Router
 */
Route::initRouter();

$ composer 

php -S 127.0.0.1:8000 ./router.php