PHP code example of pimolo / simple-router
1. Go to this page and download the library: Download pimolo/simple-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/ */
pimolo / simple-router example snippets
use Pimolo\SimpleRouter\Router;
use Pimolo\SimpleRouter\DTO\Route;
use Symfony\Component\HttpFoundation\Request;
outes
$home = (new Route('/home', ['GET'], function () {
return 'Welcome to my app';
}
));
$login = (new Route('/login', ['GET', 'POST'], function () {
return 'Please login';
}
));
// Handle the resource
echo $kernel->route($request, [$home, $login]);