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)27623MITPHPPHP &gt;=7.4

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 1mo ago

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 64% 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

2115d 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.8k18.5M1.6k](/packages/cakephp-cakephp)[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[rareloop/lumberjack-core

A powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code

42155.0k19](/packages/rareloop-lumberjack-core)[laminas/laminas-psr7bridge

Bidirectional conversions between PSR-7 and laminas-http messages

117.9M18](/packages/laminas-laminas-psr7bridge)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)

PHPackages © 2026

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