boulzy / array-comparator
A library to compare arrays using matching functions
1.0.1
2023-10-23 19:58 UTC
Requires
- php: ^8.2
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.35
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.4
- symfony/var-dumper: ^6.3
README
Description
The boulzy/array-comparator
PHP library is an extraction of the ArrayContainsComparator
originally found in
imbo/behat-api-extension
. It is designed to simplify array comparison
using matching functions, providing a set of tools to make array comparisons more efficient and convenient.
Installation
To install this library, you can use Composer:
composer require boulzy/array-comparator
Usage
Here's how you can use this library to compare arrays using matching functions:
require_once 'vendor/autoload.php';
$comparator = new \Boulzy\ArrayComparator\ArrayComparator();
$result = $comparator->compare($expected, $actual);
You can pass an array and/or a json string as either of the two parameters.
To see how to format the jsons / arrays, please refer to imbo/behat-api-extension documentation.
License
This project is licensed under the MIT License.