PHP code example of millennium / router

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

    

millennium / router example snippets




illennium\Router\Router;
use Millennium\Router\RouterCollection;

$routerCollection = new RouterCollection();
$collections = $routerCollection->collectRouters("router.yml");

$router = new Router();

try {
    $route = $router->findRoute('/', $collections);
} catch (\Exception $e) {
    trigger_error($e->getMessage(), E_USER_ERROR);
}
apacheconf
FallbackResource /index.php
conf
location / {
  try_files $uri $uri/ /index.php?$args;
}