PHPackages                             helmich/phpunit-psr7-assert - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. helmich/phpunit-psr7-assert

ActiveLibrary[Testing &amp; Quality](/categories/testing)

helmich/phpunit-psr7-assert
===========================

PHPUnit assertions for testing PSR7-compliant applications

v4.4.2(4mo ago)271.3M↑38.1%5[1 issues](https://github.com/martin-helmich/phpunit-psr7-assert/issues)10MITPHPPHP ^8.1CI passing

Since Dec 14Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/martin-helmich/phpunit-psr7-assert)[ Packagist](https://packagist.org/packages/helmich/phpunit-psr7-assert)[ Fund](https://donate.helmich.me)[ GitHub Sponsors](https://github.com/martin-helmich)[ RSS](/packages/helmich-phpunit-psr7-assert/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (25)Used By (10)

PSR-7 assertions for PHPUnit
============================

[](#psr-7-assertions-for-phpunit)

[![Unit tests](https://github.com/martin-helmich/phpunit-psr7-assert/workflows/Unit%20tests/badge.svg)](https://github.com/martin-helmich/phpunit-psr7-assert/workflows/Unit%20tests/badge.svg)[![Maintainability](https://camo.githubusercontent.com/ee464ac26b39519574c67927fd61824e9fea837eff818f316b756cd667cb0bcb/68747470733a2f2f716c74792e73682f67682f6d617274696e2d68656c6d6963682f70726f6a656374732f706870756e69742d707372372d6173736572742f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/martin-helmich/projects/phpunit-psr7-assert)[![Code Coverage](https://camo.githubusercontent.com/56e15e9d310b4175f1b8affb8b4b656f30b29a26254e9916a457e296e97ab7f9/68747470733a2f2f716c74792e73682f67682f6d617274696e2d68656c6d6963682f70726f6a656374732f706870756e69742d707372372d6173736572742f636f7665726167652e737667)](https://qlty.sh/gh/martin-helmich/projects/phpunit-psr7-assert)

This library adds several new assertions to [PHPUnit](https://phpunit.de/)that allow you to easily and concisely test HTTP request and response messages that implement the [PSR-7](https://www.php-fig.org/psr/psr-7/)interfaces.

Author and copyright
--------------------

[](#author-and-copyright)

Martin Helmich This library is [MIT-licensed](LICENSE.txt).

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

[](#installation)

```
$ composer require helmich/phpunit-psr7-assert

```

Compatibility
-------------

[](#compatibility)

There are several release branches of this library, each of these being compatible with different releases of PHPUnit and PHP. The following table should give an easy overview:

PSR-7 assertion versionPHPUnit 4PHPUnit 5PHPUnit 6PHPUnit 7PHPUnit 8PHPUnit 9PHPUnit 10PHPUnit 11PHPUnit 12v1 (branch `v1`), **unsupported**✅✅🚫🚫🚫🚫🚫🚫🚫v2 (branch `v2`), **unsupported**🚫🚫✅🚫🚫🚫🚫🚫🚫v3 (branch `v3`), **unsupported**🚫🚫🚫✅🚫🚫🚫🚫🚫v4 (branch `master`)🚫🚫🚫🚫✅✅✅✅✅When you are using `composer require` and have already declared a dependency to `phpunit/phpunit` in your `composer.json` file, Composer should pick latest compatible version automatically.

Usage
-----

[](#usage)

### Using the `Psr7Assertions` trait

[](#using-the-psr7assertions-trait)

Simply use the trait `Helmich\Psr7Assert\Psr7Assertions` in any of your test cases. This trait offers a set of new `assert*` functions that you can use in your test cases:

```
