xylemical / router
Provides framework for routing compilation.
dev-master
2022-06-30 05:49 UTC
Requires
- php: >=8.0
- psr/container: >=1.0
- psr/http-message: >=1.0
- xylemical/code: dev-master
- xylemical/code-php: dev-master
- xylemical/code-writer-twig: dev-master
Requires (Dev)
- mikey179/vfsstream: ^1.6
- xylemical/composer-dev-bundle: ^0.1.1
This package is auto-updated.
Last update: 2025-03-29 00:53:30 UTC
README
Provides a framework for routing PSR-7 server requests into invokable controllers.
Install
The recommended way to install this library is through composer.
composer require xylemical/router
Usage
use Xylemical\Container\RouterBuilder; $container = ...; // A source defined by Psr\Container\ContainerInterface. $source = ...; // A source defined by \Xylemical\Router\Source\SourceInterface. $builder = new RouterBuilder($container, $source, 'config/router.php'); $router = $builder->getRouter(); $route = $router->match($request); if ($route && $route->getController()) { $response = $route->getController()(); }
License
MIT, see LICENSE.