fiveorbs/router

PSR-7/PSR-15 router and dispatcher

dev-main 2024-11-17 20:42 UTC

This package is auto-updated.

Last update: 2024-11-17 20:45:25 UTC


README

A PSR-7 compatible router and view dispatcher.

<?php
$router = new Router();
$router->get('/{name}', funtion (string $name) { return "<h1>{$name}</h1>"; });
$request = new ServerRequest();
$route = $router->match($request);
$dispatcher = new Dispatcher();
$response = $dispatcher->dispatch($request, $route);