PHPackages                             wyrihaximus/json-psr7 - 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. [API Development](/categories/api)
4. /
5. wyrihaximus/json-psr7

ActiveLibrary[API Development](/categories/api)

wyrihaximus/json-psr7
=====================

JSON encode and decode PSR-7 requests and responses

1.4.0(9mo ago)1167.8k1[1 issues](https://github.com/WyriHaximus/php-json-psr7/issues)MITMakefilePHP ^8.4CI failing

Since Mar 4Pushed 3w ago2 watchersCompare

[ Source](https://github.com/WyriHaximus/php-json-psr7)[ Packagist](https://packagist.org/packages/wyrihaximus/json-psr7)[ GitHub Sponsors](https://github.com/WyriHaximus)[ RSS](/packages/wyrihaximus-json-psr7/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (12)Versions (21)Used By (0)

JSON encode and decode PSR-7 requests and responses
===================================================

[](#json-encode-and-decode-psr-7-requests-and-responses)

[![Continuous Integration](https://github.com/WyriHaximus/php-json-psr7/workflows/Continuous%20Integration/badge.svg)](https://github.com/WyriHaximus/php-json-psr7/workflows/Continuous%20Integration/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/3991f3672354e46a8917b32274ff9dae753eedc0f9db0817d644ea277a8ab49a/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f6a736f6e2d707372372f762f737461626c652e706e67)](https://packagist.org/packages/WyriHaximus/json-psr7)[![Total Downloads](https://camo.githubusercontent.com/f96b9fbaa56148ccf4ad4febcbf70660245c08ac0caa5c8cdc37f23180412f00/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f6a736f6e2d707372372f646f776e6c6f6164732e706e67)](https://packagist.org/packages/WyriHaximus/json-psr7)[![Code Coverage](https://camo.githubusercontent.com/80ea11263c2c370b0f8773123310aa1045d976e24651e3ffd1cc4b297e93f924/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57797269486178696d75732f7068702d6a736f6e2d707372372f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/WyriHaximus/php-json-psr7/?branch=master)[![License](https://camo.githubusercontent.com/599509604dcc9e476162a692197bd37bf37da0ef1866a44748740ce3fc4596f8/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f6a736f6e2d707372372f6c6963656e73652e706e67)](https://packagist.org/packages/wyrihaximus/json-psr7)[![PHP 7 ready](https://camo.githubusercontent.com/02b554525340e3bd61abe8dd2b4660ebbd38e82df40968be57b3e4e4c7a7d805/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f57797269486178696d75732f7068702d6a736f6e2d707372372f62616467652e737667)](https://travis-ci.org/WyriHaximus/php-json-psr7)

### Installation

[](#installation)

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `~`.

```
composer require wyrihaximus/json-psr7

```

Requirements
============

[](#requirements)

All encoding functions assume al streams are fully read and `getContents()` calls will return all contents for that stream/body failure will result in missing stream/body parts.

Available functions
===================

[](#available-functions)

All `*_decode` functions throw when there are items missing in the array. All functions throw when there is an error encoding/decoding to/from JSON.

- `psr7_response_json_encode` - Encodes a PSR-7 Response to a JSON string
- `psr7_response_encode` - Encodes a PSR-7 Response to an array
- `psr7_response_json_decode` - Decodes a JSON string encoded with `psr7_response_json_encode` back into a PSR-7 Response
- `psr7_response_decode` - Decodes an array encoded with `psr7_response_encode` back into a PSR-7 Response
- `psr7_request_json_encode` - Encodes a PSR-7 Request to a JSON string
- `psr7_request_encode` - Encodes a PSR-7 Request to an array
- `psr7_request_json_decode` - Decodes a JSON string encoded with `psr7_request_json_encode` back into a PSR-7 Request
- `psr7_request_decode` - Decodes an array encoded with `psr7_request_encode` back into a PSR-7 Request
- `psr7_uploaded_file_json_encode` - Encodes a PSR-7 Uploaded File to a JSON string
- `psr7_uploaded_file_encode` - Encodes a PSR-7 Uploaded File to an array
- `psr7_uploaded_file_json_decode` - Decodes a JSON string encoded with `psr7_uploaded_file_json_encode` back into a PSR-7 Uploaded File
- `psr7_uploaded_file_decode` - Decodes an array encoded with `psr7_uploaded_file_encode` back into a PSR-7 Uploaded File
- `psr7_server_request_json_encode` - Encodes a PSR-7 Server Request to a JSON string
- `psr7_server_request_encode` - Encodes a PSR-7 Server Request to an array
- `psr7_server_request_json_decode` - Decodes a JSON string encoded with `psr7_server_request_json_encode` back into a PSR-7 Server Request
- `psr7_server_request_decode` - Decodes an array encoded with `psr7_server_request_encode` back into a PSR-7 Server Request

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

Copyright 2026 [Cees-Jan Kiewiet](http://wyrihaximus.net/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance76

Regular maintenance activity

Popularity34

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~486 days

Total

11

Last Release

294d ago

PHP version history (5 changes)1.0.0PHP ^7.0

1.1.0PHP ^7.2

1.2.0PHP ^7.4

1.3.0PHP ^8 || ^7.4

1.4.0PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/147145?v=4)[Cees-Jan Kiewiet](/maintainers/WyriHaximus)[@WyriHaximus](https://github.com/WyriHaximus)

---

Top Contributors

[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (168 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (62 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (57 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (31 commits)")[![renovate-runner[bot]](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/renovate-runner[bot] "renovate-runner[bot] (23 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (10 commits)")

---

Tags

hacktoberfestjsonphpphp7psr-7psr7

### Embed Badge

![Health badge](/badges/wyrihaximus-json-psr7/health.svg)

```
[![Health](https://phpackages.com/badges/wyrihaximus-json-psr7/health.svg)](https://phpackages.com/packages/wyrihaximus-json-psr7)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

43.6k344.8k1](/packages/ccxt-ccxt)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.8M179](/packages/algolia-algoliasearch-client-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k52](/packages/neuron-core-neuron-ai)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[cakephp/authentication

Authentication plugin for CakePHP

1214.3M118](/packages/cakephp-authentication)

PHPackages © 2026

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