PHPackages                             sidz/phpunit-json-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. sidz/phpunit-json-assert

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

sidz/phpunit-json-assert
========================

PHPUnit assertions for JSON documents

v3.6.0(6mo ago)013MITPHPPHP ^8.1CI passing

Since Dec 24Pushed 5mo agoCompare

[ Source](https://github.com/sidz/phpunit-json-assert)[ Packagist](https://packagist.org/packages/sidz/phpunit-json-assert)[ RSS](/packages/sidz-phpunit-json-assert/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

JSON assertions for PHPUnit
===========================

[](#json-assertions-for-phpunit)

[![Unit tests](https://github.com/sidz/phpunit-json-assert/workflows/Unit%20tests/badge.svg)](https://github.com/sidz/phpunit-json-assert/workflows/Unit%20tests/badge.svg)

This library adds several new assertions to [PHPUnit](https://phpunit.de/)that allow you to easily and concisely verify complex data structures (often, but not necessarily, JSON documents) using JSONPath expressions and JSON schemas.

Copyright
---------

[](#copyright)

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

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

[](#installation)

```
$ composer require --dev sidz/phpunit-json-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:

"JSON assertion" versionPHPUnit 4PHPUnit 5PHPUnit 6PHPUnit 7PHPUnit 8PHPUnit 9PHPUnit 10PHPUnit 11PHPUnit 12v1 (branch `v1`), **unsupported**✅✅🚫🚫🚫🚫🚫🚫🚫v2 (branch `v2`)🚫🚫✅✅🚫🚫🚫🚫🚫v3 (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)

Simply use the trait `Sid\JsonAssert\JsonAssertions` in your test case. This trait offers a set of new `assert*` functions that you can use in your test cases:

```
