PHP code example of phplegends / routes
1. Go to this page and download the library: Download phplegends/routes 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/ */
phplegends / routes example snippets
$router = new \PHPLegends\Routes\Router;
$router->get('/', function () {
return 'Hello World';
});
$page = isset($_GET['page']) ? $_GET['page'] : '/';
$dispatcher = new \PHPLegends\Routes\Dispatcher($page, $_SERVER['REQUEST_METHOD']);
echo $router->dispatch($dispatcher);