alexpts/psr15-middleware-manager

View on GitHub
README.md

Summary

Maintainability
Test Coverage
# psr15-middleware-manager

[![Build Status](https://travis-ci.org/alexpts/psr15-middleware-manager.svg?branch=master)](https://travis-ci.org/alexpts/psr15-middleware-manager)
[![Code Coverage](https://scrutinizer-ci.com/g/alexpts/psr15-middleware-manager/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/alexpts/psr15-middleware-manager/?branch=master)
[![Code Climate](https://codeclimate.com/github/alexpts/psr15-middleware-manager/badges/gpa.svg)](https://codeclimate.com/github/alexpts/psr15-middleware-manager)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/alexpts/psr15-middleware-manager/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/alexpts/psr15-middleware-manager/?branch=master)


Middleware manager compatible with the [PSR-7](https://www.php-fig.org/psr/psr-7/) and [PSR-15](https://www.php-fig.org/psr/psr-15/)

## Installation

```$ composer require alexpts/psr15-middleware-manager```


## Example
```php
use PTS\PSR15\MiddlewareManager\MiddlewareManager;

$manager = new MiddlewareManager;

$manager
    ->use($logMiddleware, '/admins/.*') // invoke only path /admins/.*
    ->use(new RequestWithAttribute(['container' => $container]))
    ->use(new RouterMiddleware);

$manager->handle($request);
```