hannesvdvreken/route-middleware

This package is abandoned and no longer maintained. No replacement package was suggested.

0.1.0 2015-09-09 21:16 UTC

This package is auto-updated.

Last update: 2022-02-01 12:51:10 UTC


README

Abandoned. Don't use this and don't send pull requests.

PSR-7 middleware for league/route

Latest Version Software License Build Status Coverage Status Quality Score

PSR-7 compatible Middleware for league/route's RouteCollection.

Installation

composer require hannesvdvreken/route-middleware

Description

This package aims to provide an easy to use middleware that takes PSR-7 Request object and converts it to a Response object by calling the Route's dispatcher class.

use League\Route\RouteCollection;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\RequestInterface;

$router = new RouteCollection();

// Setup router
$router->addRoute('GET', '/robots.txt', function (RequestInterface $request, ResponseInterface $response) {
    // Adjust the response
    return $response;
});

$app = new League\Route\Stack\Middleware($router);

$response = $app->handle($request);

Contributing

Contributions are welcome. See the contributions file to know how to contribute.

License

The MIT License (MIT). Please see License File for more information.