PHPackages                             pawel-jakowczyk/middleware - 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. [Framework](/categories/framework)
4. /
5. pawel-jakowczyk/middleware

ActiveLibrary[Framework](/categories/framework)

pawel-jakowczyk/middleware
==========================

The request handler responsible for processing middlewares

0.1.0(4y ago)0332MITPHP

Since Jun 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/pawel-jakowczyk/middleware)[ Packagist](https://packagist.org/packages/pawel-jakowczyk/middleware)[ RSS](/packages/pawel-jakowczyk-middleware/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (6)Versions (2)Used By (2)

PJ Middleware Request Handler
=============================

[](#pj-middleware-request-handler)

[![Tests](https://github.com/pawel-jakowczyk/middleware/actions/workflows/php.yml/badge.svg)](https://github.com/pawel-jakowczyk/middleware/actions/workflows/php.yml)

This repository holds the MiddlewareFactoryRequestHandler which implements the Psr\\Http\\Server\\RequestHandlerInterface. The request handler is responsible for processing the collection of middlewares and final request handler.

To define middleware collection and request handler one needs to create MiddlewareFactory and HandlerFactory implementations. Those factories should be than passed to request under AttributeNames::MIDDLEWARE\_FACTORY and AttributeNames::HANDLER\_FACTORY. The MiddlewareRoute can be used in order to pass factories as route defaults.

The reason why factories are used is not to create objects with their dependencies too early when they might not be used, by using factories they are created during MiddlewareFactoryRequestHandler execution.

Instalation
-----------

[](#instalation)

```
composer require pawel-jakowczyk/middleware

```

Usage
-----

[](#usage)

```
use Laminas\Diactoros\Response;
use Laminas\Diactoros\ServerRequest;
use PJ\Middleware\AttributeNames;
use PJ\Middleware\HandlerFactory;
use PJ\Middleware\MiddlewareFactoryRequestHandler;
use PJ\Middleware\EmptyMiddlewareFactory;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;

(new MiddlewareFactoryRequestHandler())->handle(
    (new ServerRequest())
        ->withAttribute(
            AttributeNames::MIDDLEWARE_FACTORY,
            new EmptyMiddlewareFactory()
        )
        ->withAttribute(
            AttributeNames::HANDLER_FACTORY,
            new class () implements HandlerFactory {
                public function createRequestHandler(): RequestHandlerInterface
                {
                    return new class() implements RequestHandlerInterface
                    {
                        public function handle(ServerRequestInterface $request): ResponseInterface
                        {
                            return new Response();
                        }
                    };
                }
            }
        )
);
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

1801d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9250203?v=4)[pawel-jakowczyk](/maintainers/pawel-jakowczyk)[@pawel-jakowczyk](https://github.com/pawel-jakowczyk)

---

Top Contributors

[![pawel-jakowczyk](https://avatars.githubusercontent.com/u/9250203?v=4)](https://github.com/pawel-jakowczyk "pawel-jakowczyk (5 commits)")

---

Tags

middlewaresrequest-handler

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pawel-jakowczyk-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/pawel-jakowczyk-middleware/health.svg)](https://phpackages.com/packages/pawel-jakowczyk-middleware)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[cakephp/authentication

Authentication plugin for CakePHP

1153.6M67](/packages/cakephp-authentication)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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