1. Go to this page and download the library: Download cr0w/phorq 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/ */
cr0w / phorq example snippets
use phorq\Router;
$router = Router::create(
__DIR__ . '/modules',
__DIR__ . '/cache/routes.php'
);
$result = $router->route();
if ($result) {
echo $result->value;
} else {
http_response_code(404);
echo '404 Not Found';
}
$result = $router->route($ctx);
// routes/login.php
if ($req->isPost()) {
// handle form submission
} else {
// render form
}
$req // Request object
$ctx // whatever was passed to route() — may be null
$router // the Router instance
// + one variable per URL param, e.g. $id, $slug, $rest