PHPackages                             stratify/http - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. stratify/http

ActiveLibrary[HTTP &amp; Networking](/categories/http)

stratify/http
=============

HTTP middlewares for PSR-7 and PSR-15

0.6.0(5y ago)29123MITPHPPHP &gt;=7.4CI failing

Since Sep 1Pushed 5y ago2 watchersCompare

[ Source](https://github.com/stratifyphp/http)[ Packagist](https://packagist.org/packages/stratify/http)[ RSS](/packages/stratify-http/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (5)Versions (9)Used By (3)

Stratify HTTP stack
===================

[](#stratify-http-stack)

HTTP middleware utilities built upon:

- PSR-7 and [Diactoros](https://docs.laminas.dev/laminas-diactoros/) as the implementation
- [PSR-15](https://www.php-fig.org/psr/psr-15/)

```
composer require stratify/http

```

Middlewares
-----------

[](#middlewares)

A middleware can be either an instance of `Psr\Http\Server\MiddlewareInterface`:

```
class MyMiddleware implements \Psr\Http\Server\MiddlewareInterface
{
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
    {
        return new Response(...);
    }
}

$middleware = new MyMiddleware;
```

or a simple callable, which allows to use closures for quickly writing middlewares:

```
$middleware = function(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface {
    return new Response(...);
}
```

Middleware pipe
---------------

[](#middleware-pipe)

The middleware pipe let us pipe middlewares to execute one after the other. It is similar to using the pipe (|) operator on the command line.

It's interesting to note that the pipe *is also a middleware*, which means it can be nested or combined with any other middleware.

Usage:

```
$middleware = new Pipe([
    new Middleware1,
    new Middleware2,
    // ...
]);

// Run
$response = $middleware->process($request, $handler);
```

The pipe will first execute `Middleware1`. If that middleware calls `$next` then `Middleware2` will be executed. An infinite number of middlewares can be piped together.

If you don't need to use the `$handler` argument for the pipe, you can use the `LastHandler` class:

```
$response = $middleware->process($request, new \Stratify\Http\Middleware\LastHandler);
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~299 days

Recently: every ~363 days

Total

7

Last Release

2161d ago

PHP version history (2 changes)0.5.0PHP &gt;=7.1

0.6.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/329a6111724074f5388e95dd41a03ccf3c43f4bfe1ecf27c94c9efc6f7823228?d=identicon)[mnapoli](/maintainers/mnapoli)

---

Top Contributors

[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (30 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stratify-http/health.svg)

```
[![Health](https://phpackages.com/badges/stratify-http/health.svg)](https://phpackages.com/packages/stratify-http)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M125](/packages/mezzio-mezzio)[cakephp/authentication

Authentication plugin for CakePHP

1214.1M106](/packages/cakephp-authentication)[mimmi20/browser-detector

Library to detect Browsers and Devices

48157.5k5](/packages/mimmi20-browser-detector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
