Skip to content

hannesvdvreken/route-middleware

Repository files navigation

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.

About

PSR-7 middleware for league/route

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages