1. Go to this page and download the library: Download hoa/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/ */
hoa / router example snippets
$router = new Hoa\Router\Http();
$router
->get('u', '/hello', function () {
echo 'world!', "\n";
})
->post('v', '/hello', function (Array $_request) {
echo $_request['a'] + $_request['b'], "\n";
})
->get('w', '/bye', function () {
echo 'ohh :-(', "\n";
})
->get('x', '/hello_(?<nick>\w+)', function ($nick) {
echo 'Welcome ', ucfirst($nick), '!', "\n";
});
$dispatcher = new Hoa\Dispatcher\Basic();
$dispatcher->dispatch($router);