PHP code example of adrienlucbert / php-router
1. Go to this page and download the library: Download adrienlucbert/php-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/ */
adrienlucbert / php-router example snippets
// use composer autoload to include package files
create an App object, against which you will then register routes
$app = new App();
// register a new route to call when requested uri matches '/' in http method GET
$app->get('/', function(&$req, callable $next) {
// do whatever you want this route to do
print_r($req);
// execute next route matching the requested uri
$next();
});
// execute application mountpoints according to the requested uri
$app->execute();
composer