fiveorbs / router
PSR-7/PSR-15 router and dispatcher
dev-main
2024-11-17 20:42 UTC
Requires
- php: >=8.3
- fiveorbs/wire: dev-main
- psr/container: ^2.0
- psr/http-message: ^1.1 || ^2.0
- psr/http-message-implementation: ^1.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- fiveorbs/dev: ^1.0
- laminas/laminas-diactoros: ^3.3
- phpunit/phpunit: ^10.4
- vimeo/psalm: ^5.15
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);