PHPackages                             phpdot/http-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. [HTTP &amp; Networking](/categories/http)
4. /
5. phpdot/http-middleware

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

phpdot/http-middleware
======================

PSR-15 middlewares for PHPdot.

v0.1.0(4w ago)00MITPHPPHP &gt;=8.5

Since Jul 18Pushed 4w agoCompare

[ Source](https://github.com/phpdot/http-middleware)[ Packagist](https://packagist.org/packages/phpdot/http-middleware)[ RSS](/packages/phpdot-http-middleware/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (18)Versions (3)Used By (0)

phpdot/http-middleware
======================

[](#phpdothttp-middleware)

PSR-15 middlewares for PHPdot. Each is a small, framework-agnostic middleware that plugs into any PSR-15 pipeline. Currently: `JsonBodyMiddleware`, which decodes JSON request bodies into the request's parsed body.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Testing](#testing)
- [License](#license)

Requirements
------------

[](#requirements)

RequirementConstraintPHP`>= 8.5``psr/http-factory``^1.0``psr/http-message``^2.0``psr/http-server-handler``^1.0``psr/http-server-middleware``^1.0`Bring any PSR-7/PSR-17 implementation (for example [phpdot/http](https://github.com/phpdot/http)).

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

[](#installation)

```
composer require phpdot/http-middleware
```

Usage
-----

[](#usage)

### JsonBodyMiddleware

[](#jsonbodymiddleware)

For requests with a `application/json` content type, it decodes the body and exposes it via `getParsedBody()`; a malformed body returns a `400` with a JSON error, and non-JSON or empty bodies pass straight through. Construct it with your PSR-17 response and stream factories and add it to the pipeline:

```
use PHPdot\HttpMiddleware\JsonBodyMiddleware;

$middleware = new JsonBodyMiddleware($responseFactory, $streamFactory);

// In your PSR-15 pipeline, before handlers that read getParsedBody()
$app->pipe($middleware);
```

```
// Downstream, the decoded body is available as the parsed body:
$data = $request->getParsedBody();
```

Testing
-------

[](#testing)

```
composer install
composer test        # PHPUnit
composer analyse     # PHPStan, level max + strict rules
composer cs-check    # PHP-CS-Fixer
composer check       # All three
```

License
-------

[](#license)

MIT.

**This repository is a read-only mirror**, generated by CI from [phpdot/monorepo](https://github.com/phpdot/monorepo). [Pull requests](https://github.com/phpdot/monorepo/pulls)and [issues](https://github.com/phpdot/monorepo/issues) belong in the monorepo.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance94

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~17 days

Total

2

Last Release

28d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.4

v0.1.0PHP &gt;=8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/62e82421bda4b5d6ba9a47ba6d88caca060dcd0d1a2862f351f3a97657385db0?d=identicon)[phpdot](/maintainers/phpdot)

---

Top Contributors

[![o3AM](https://avatars.githubusercontent.com/u/252500?v=4)](https://github.com/o3AM "o3AM (1 commits)")[![phpdot](https://avatars.githubusercontent.com/u/252500?v=4)](https://github.com/phpdot "phpdot (1 commits)")

---

Tags

httppsr-7jsonmiddlewarepsr-15

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B4.4k](/packages/guzzlehttp-psr7)[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.8k](/packages/cakephp-cakephp)[sunrise/http-router

A powerful solution as the foundation of your project.

16852.3k12](/packages/sunrise-http-router)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[mezzio/mezzio

PSR-15 Middleware Microframework

3973.9M133](/packages/mezzio-mezzio)[typo3/cms-core

TYPO3 CMS Core

3313.6M5.6k](/packages/typo3-cms-core)

PHPackages © 2026

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