PHPackages                             hotaruma/pipeline - 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. hotaruma/pipeline

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

hotaruma/pipeline
=================

Pipeline library built on top of PSR-15, PSR-7, and PSR-11 standards for handling HTTP requests and responses with middleware support.

v0.2.3(2y ago)07MITPHPPHP &gt;=8.1

Since Jun 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hotaruma/pipeline)[ Packagist](https://packagist.org/packages/hotaruma/pipeline)[ Docs](https://github.com/hotaruma/pipeline)[ RSS](/packages/hotaruma-pipeline/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (7)Used By (0)

PSR-15 Pipeline
===============

[](#psr-15-pipeline)

[![Build and Test](https://github.com/hotaruma/pipeline/actions/workflows/ci.yml/badge.svg)](https://github.com/hotaruma/pipeline/actions/workflows/ci.yml)[![Latest Version](https://camo.githubusercontent.com/e56a3cf7f926090a2b633de4cb12597d56931e8784caa74cb05051bf7cf7199d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f686f746172756d612f706970656c696e652e737667)](https://github.com/hotaruma/pipeline/releases)[![License](https://camo.githubusercontent.com/1bfbb1485b14a1de44d04ea3262c6b421395b8b1ae2cdec7f9ab0ee63509330c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f686f746172756d612f706970656c696e652e737667)](https://github.com/hotaruma/pipeline/blob/master/LICENSE)[![PHP from Packagist](https://camo.githubusercontent.com/9366e7a5666c2509ea85eb2f2800e4cabd1830c01dced7b12c42d6de4917ecab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686f746172756d612f706970656c696e65)](https://camo.githubusercontent.com/9366e7a5666c2509ea85eb2f2800e4cabd1830c01dced7b12c42d6de4917ecab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686f746172756d612f706970656c696e65)[![Packagist Downloads](https://camo.githubusercontent.com/7e5ef7405484ca06dc98366fbb4c7d997becae4698ada0a51d5fd5b84e6b80c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686f746172756d612f706970656c696e652e737667)](https://packagist.org/packages/hotaruma/pipeline)[![codecov](https://camo.githubusercontent.com/2ce2b97e595b2e4489a598636a55cec93efa55d574e27dc13e14f77b6afd0d58/68747470733a2f2f636f6465636f762e696f2f67682f686f746172756d612f706970656c696e652f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/hotaruma/pipeline)

Pipeline library for handling HTTP requests and responses with middleware.

Features
--------

[](#features)

- Integration with PSR-7 HTTP messages and PSR-11 container.
- Support for middleware/pipeline chaining to process HTTP requests in a flexible way.

Installation
------------

[](#installation)

You can install the library using Composer. Run the following command:

```
composer require hotaruma/pipeline
```

Usage
-----

[](#usage)

Simple example of how you can use `Pipeline` to process an HTTP request:

```
use Hotaruma\Pipeline\Pipeline;

$pipeline = new Pipeline();

$pipeline->pipe(
    ErrorMiddleware::class,
    LogMiddleware::class,
    RouteMiddleware::class,
);

$response = $pipeline->process($serverRequest, RouteNotFoundMiddleware::class);
```

By nesting pipelines within one another, it becomes possible to compose more complex and reusable middleware structures, providing flexibility and modularity in application development.

```
$authPipeline = new Pipeline();

$authPipeline->pipe(
    AccessLogMiddleware::class,
    AuthMiddleware::class,
);

$pipeline->pipe(
    ErrorMiddleware::class,
    LogMiddleware::class,
    $authPipeline,
);

$response = $pipeline->process($serverRequest, RequestHandler::class);
```

Using a pipeline as a request handler.

```
$requestHandlerPipeline = new Pipeline();

$requestHandlerPipeline->pipe(
    LogMiddleware::class,
    RouteNotFoundMiddleware::class
);
$response = $pipeline->process($serverRequest, $requestHandlerPipeline);
```

Pipeline can be rewound.

```
$pipeline->rewind();
```

We can pass request handler as a callable.

```
use Zend\Diactoros\Response;
use GuzzleHttp\Psr7\Utils;

$response = $pipeline->process($serverRequest, function (ServerRequestInterface $request): ResponseInterface {
    return (new Response())
        ->withStatus(404)
        ->withHeader('Content-Type', 'text/plain')
        ->withBody(Utils::streamFor('Not Found'));
});
```

Resolvers are responsible for resolving middleware and request handler classes, allowing for dynamic retrieval and instantiation of these components within the pipeline. By default, pipelines usually use a specific resolver implementation.

```
use Hotaruma\Pipeline\Resolver\{MiddlewareResolver, RequestHandlerResolver};

$pipeline->middlewareResolver(new MiddlewareResolver());
$pipeline->handlerResolver(new RequestHandlerResolver());

$pipeline->getMiddlewareResolver()->container($container);
$pipeline->getRequestHandlerResolver()->container($container);
```

The middleware store is responsible for managing and storing the middleware that is added to the pipeline. It provides the necessary functionality to add, retrieve, and execute the middleware in the desired order.

```
use Hotaruma\Pipeline\MiddlewareStore\MiddlewareStore;

$pipeline->middlewareStore(new MiddlewareStore());
```

Contributing
------------

[](#contributing)

Contributions are welcome! If you find a bug or have an idea for a new feature, please open an issue or submit a pull request.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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 ~3 days

Total

5

Last Release

1034d ago

PHP version history (2 changes)v0.1.0PHP &gt;=8.2

v0.2.2PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f5080e0a006b5fda1d8d127ba8ce022e2882e5b613f4a7455d775848c70d60a?d=identicon)[hotaruma](/maintainers/hotaruma)

---

Top Contributors

[![hotaruma](https://avatars.githubusercontent.com/u/29927576?v=4)](https://github.com/hotaruma "hotaruma (20 commits)")

---

Tags

middlewarepipelinepsr-11psr-15psr-7psr-7middlewarePSR-11psr-15pipeline

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hotaruma-pipeline/health.svg)

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

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[middlewares/utils

Common utils for PSR-15 middleware packages

503.4M92](/packages/middlewares-utils)[php-middleware/php-debug-bar

PHP Debug Bar PSR-15 middleware with PSR-7

76433.5k2](/packages/php-middleware-php-debug-bar)[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[middlewares/request-handler

Middleware to execute request handlers

451.6M26](/packages/middlewares-request-handler)[mezzio/mezzio-skeleton

Laminas mezzio skeleton. Begin developing PSR-15 middleware applications in seconds!

12726.2k](/packages/mezzio-mezzio-skeleton)

PHPackages © 2026

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