class RouterMiddleware implements MiddlewareInterface (View source)

Routing middleware that uses router to point requests to appropriate handlers.

Methods

__construct(Router $router, ContainerInterface $container, ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)

RouterMiddleware constructor.

ResponseInterface
process(ServerRequestInterface $request, RequestHandlerInterface $handler)

{@inheritdoc}

Details

__construct(Router $router, ContainerInterface $container, ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)

RouterMiddleware constructor.

Parameters

Router $router The router used to map requests to handlers
ContainerInterface $container Container used to load handlers and additional middleware
ResponseFactoryInterface $responseFactory The http factory used to generate error responses
StreamFactoryInterface $streamFactory The http factory used to generate error bodies

ResponseInterface process(ServerRequestInterface $request, RequestHandlerInterface $handler)

{@inheritdoc}

Parameters

ServerRequestInterface $request
RequestHandlerInterface $handler

Return Value

ResponseInterface