A FastRoute router implementation.

0.1.1 2022-02-19 16:26 UTC

This package is auto-updated.

Last update: 2022-05-19 18:09:37 UTC


Build Status Latest Stable Version License

A FastRoute router implementation, inspired by the one you can find in the excellent Mezzio Routing Interfaces.
The router is based on nikic/fastroute request router.

You need to provide a PSR-7 ServerRequestInterface in order to match the routes.
A PSR-7 ResponseInterface must be returned by the route handler.


Via composer :

composer require borschphp/router


require_once __DIR__.'/vendor/autoload.php';

$router = new \Borsch\Router\FastRouteRouter();

$router->addRoute(new \Borsch\Router\Route(
    new HomeHandler(), // Instance of RequestHandlerInterface

$server_request = \Laminas\Diactoros\ServerRequestFactory::fromGlobals();

$route_result = $router->match(\Laminas\Diactoros\ServerRequestFactory::fromGlobals());

// $route_result is an instance of RouteResultInterface
$response = $route_result->getMatchedRoute()->getHandler()->handle($server_request);

// Send the response back to the client or other...


The package is licensed under the MIT license. See License File for more information.