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

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

ezitisitis/phpunit-json-assert
==============================

PHPUnit assertions for JSON documents

3.4.3(3y ago)068MITPHPPHP ^7.2 || ^8.0

Since Dec 13Pushed 3y agoCompare

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

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

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

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

[![Unit tests](https://github.com/martin-helmich/phpunit-json-assert/workflows/Unit%20tests/badge.svg)](https://github.com/martin-helmich/phpunit-json-assert/workflows/Unit%20tests/badge.svg)[![Code Climate](https://camo.githubusercontent.com/79ed9a2b7c8f85e058a8b3efbcc22b40aa83ebf53ed6886ec3adfc5b73cd1914/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d617274696e2d68656c6d6963682f706870756e69742d6a736f6e2d6173736572742f6261646765732f6770612e737667)](https://codeclimate.com/github/martin-helmich/phpunit-json-assert)[![Test Coverage](https://camo.githubusercontent.com/b000db55ff148d54d4312f03a04b44d02c3a4ba6e46925a5cf38ec0bba1e701a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d617274696e2d68656c6d6963682f706870756e69742d6a736f6e2d6173736572742f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/martin-helmich/phpunit-json-assert/coverage)[![Issue Count](https://camo.githubusercontent.com/4201111cbb73bf07f666b787fbdd93c728923c5721bdfb8919dd110271ce0196/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d617274696e2d68656c6d6963682f706870756e69742d6a736f6e2d6173736572742f6261646765732f69737375655f636f756e742e737667)](https://codeclimate.com/github/martin-helmich/phpunit-json-assert)

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.

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

[](#author-and-copyright)

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

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

[](#installation)

```
$ composer require --dev helmich/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 9v1 (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 `Helmich\JsonAssert\JsonAssertions` in your test case. This trait offers a set of new `assert*` functions that you can use in your test cases:

```
