PHP code example of mzb / php-router-matcher

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

    

mzb / php-router-matcher example snippets

 php
composer 
 php

 declare(strict_types=1);

use Mzb\Router\Router;

ller\\');

$router->add('GET', '/', 'HomeController@index', 'home');
$router->add('GET', '/about', 'HomeController@about', 'about-us');
$router->add('GET', '/about/:id/:slug', 'AboutController@about', 'about-us');
$router->add('POST', '/about/:id', 'AboutController@about', 'about-us');
$router->add('GET', '/contact', function () { echo 'Contact'; }, 'contact');