Search by

boulzy / array-comparator

Boulzy

This package is abandoned and no longer maintained. The author suggests using the coduo/php-matcher package instead.

A library to compare arrays using matching functions

Package info

gitlab.com/boulzy/array-comparator

Issues

pkg:composer/boulzy/array-comparator

Statistics

Installs: 224

Dependents: 0

Suggesters: 0

Stars: 0

1.0.3 2026-11-15 13:12 UTC

This package is auto-updated.

Last update: 2026-11-15 12:16:30 UTC


README

[!WARNING] This package is no longer maintained. Use coduo/php-matcher instead: it does everything this library does, and more. The repository is archived; existing installs keep working.

boulzy/array-comparatorcoduo/php-matcher
@variableType(string)@string@
@regExp(/^\d+$/)@string@.matchRegex("/^\d+$/")
@gt(5)@integer@.greaterThan(5)
@arrayLength(3)@array@.count(3)

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.