PHP code example of routing-interop / route

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

    

routing-interop / route example snippets




use Interop\Routing\Route\RouteCollection;

$routes = (new RouteCollection)
    ->get('/blog',        [BlogController::class, 'index'])
    ->get('/blog/{slug}', [BlogController::class, 'show'])
    ->post('/blog',       [BlogController::class, 'create'])
;