RoutingMiddleware which implements the Psr MiddlewareInterface

1.0.0 2021-05-19 18:01 UTC

This package is auto-updated.

Last update: 2022-06-19 20:36:23 UTC



This repository holds the RoutingMiddleware which implements the Psr\Http\Server\MiddlewareInterface. It can be instantiated by create method which requires symfony RouteCollection, or it can be instantiated by constructor which requires the RequestMatcherInterface object.


composer require pawel-jakowczyk/routing


use Laminas\Diactoros\ServerRequest;
use PJ\Routing\RoutingMiddleware;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Symfony\Component\Routing\RouteCollection;

$middleware = RoutingMiddleware::create(new RouteCollection());
    new ServerRequest(),
    new class() implements RequestHandlerInterface
        public function handle(ServerRequestInterface $request): ResponseInterface
            return new Response();