<commit_before># middleware

[![Build Status](https://travis-ci.org/JanHuang/middleware.svg?branch=master)](https://travis-ci.org/JanHuang/middleware)
[![Support PSR15](https://img.shields.io/badge/support-psr15-brightgreen.svg)](https://travis-ci.org/JanHuang/middleware)
[![Latest Stable Version](https://poser.pugx.org/fastd/middleware/v/stable)](https://packagist.org/packages/fastd/middleware)
[![License](https://poser.pugx.org/fastd/middleware/license)](https://packagist.org/packages/fastd/middleware)
[![composer.lock](https://poser.pugx.org/fastd/middleware/composerlock)](https://packagist.org/packages/fastd/middleware)

Http 中间件，实现PSR15

### requirement

* php >= 5.6

### installation

```
composer require "fastd/middlware:1.0.x-dev" -vvv
```

```php
$middleware = new Middleware(function (RequestInterface $request, DelegateInterface $next) {
    // delegate control to next middleware
    return $next($request);
});

$middleware2 = new Middleware(function (RequestInterface $request, DelegateInterface $next) {
    echo 'world';
});

$stack = new Stack();
$stack->withoutMiddleware($middleware);
$stack->withoutMiddleware($middleware2);

$response = $stack->process(new ServerRequest());
```

### License MIT<commit_msg>update doc<commit_after># middleware

[![Build Status](https://travis-ci.org/JanHuang/middleware.svg?branch=master)](https://travis-ci.org/JanHuang/middleware)
[![Support PSR15](https://img.shields.io/badge/support-psr15-brightgreen.svg)](https://travis-ci.org/JanHuang/middleware)
[![Latest Stable Version](https://poser.pugx.org/fastd/middleware/v/stable)](https://packagist.org/packages/fastd/middleware)
[![License](https://poser.pugx.org/fastd/middleware/license)](https://packagist.org/packages/fastd/middleware)
[![composer.lock](https://poser.pugx.org/fastd/middleware/composerlock)](https://packagist.org/packages/fastd/middleware)

Http 中间件，实现PSR15

### requirement

* php >= 5.6

### installation

```
composer require "fastd/middlware:1.0.x-dev" -vvv
```

```php
$middleware = new Middleware(function (RequestInterface $request, DelegateInterface $next) {
    // delegate control to next middleware
    return $next($request);
});

$middleware2 = new Middleware(function (RequestInterface $request, DelegateInterface $next) {
    echo 'world';
});

$dispatcher = new Dispatcher([
    $middleware,
    $middleware2
]);

$response = $dispatcher->dispatch(new ServerRequest('GET', '/'));
```

### License MIT
{'fraction_non_alphanumeric': 0.18370672097759674, 'fraction_numerical': 0.009775967413441956, 'mean_word_length': 5.841225626740947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6732415', 'n_tokens_mistral': 881, 'n_tokens_neox': 845, 'n_words': 110}