1. Go to this page and download the library: Download lombokclarion/routing 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/ */
lombokclarion / routing example snippets
LombokClarion\Routing
use LombokClarion\Routing\Router;
use LombokClarion\Routing\Kernel;
$router = new Router();
$router->get('/', [HomeController::class, 'index']);
$router->post('/widgets', [WidgetController::class, 'store'], [
ValidateCsrf::class,
RateLimit::perMinute(30, $store),
]);
$router->group('/api', [Authenticate::class], function (Router $r) {
$r->get('/users', [UserController::class, 'list']);
$r->get('/users/{id}', [UserController::class, 'show']);
});
// Boot
$kernel = new Kernel($container, $router, globalMiddleware: [SecurityHeaders::class]);
$response = $kernel->handle($request);
// Production: use compiled routes
$matcher = CompiledRouteMatcher::fromFile('storage/routes.compiled.php');
$kernel = new Kernel($container, $router, compiledMatcher: $matcher);
// PHP-FPM (index.php)
(new FpmAdapter())->run($kernel);
// Swoole
(new SwooleAdapter('0.0.0.0', 8080))->run($kernel);
// Serverless
(new FunctionAdapter($event))->run($kernel);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.