boulzy/array-comparator

A library to compare arrays using matching functions

1.0.1 2023-10-23 19:58 UTC

This package is auto-updated.

Last update: 2024-10-23 22:13:03 UTC


README

pipeline status coverage report License

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.