PHPackages                             benjaminmal/parity-checker - 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. benjaminmal/parity-checker

ActiveLibrary

benjaminmal/parity-checker
==========================

Parity checker

v2.0.0(3y ago)1106[1 PRs](https://github.com/benjaminmal/parity-checker/pulls)MITPHPPHP ^8.0CI failing

Since Nov 18Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/benjaminmal/parity-checker)[ Packagist](https://packagist.org/packages/benjaminmal/parity-checker)[ RSS](/packages/benjaminmal-parity-checker/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (8)Dependencies (14)Versions (17)Used By (0)

Parity-checker
==============

[](#parity-checker)

[![Continuous integration](https://github.com/benjaminmal/parity-checker/actions/workflows/ci.yaml/badge.svg)](https://github.com/benjaminmal/parity-checker/actions/workflows/ci.yaml)

A PHP parity checker. Useful when you want to check if many objects are having the same datas. It has many options so you can configure the behavior you need, especially speaking of object recursion.

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

[](#installation)

```
$ composer require benjaminmal/parity-checker
```

Getting started
---------------

[](#getting-started)

### Create the Parity checker using the factory:

[](#create-the-parity-checker-using-the-factory)

```
$parityChecker = ParityChecker::create();
```

### Or using your implementations using Symfony [PropertyAccess](https://symfony.com/doc/current/components/property_access.html) &amp; [PropertyInfo](https://symfony.com/doc/current/components/property_info.html) components

[](#or-using-your-implementations-using-symfony-propertyaccess--propertyinfo-components)

```
/** @var PropertyAccessorInterface $propertyAccessor */
/** @var PropertyInfoExtractorInterface $propertyInfoExtractor */

$parityChecker = new ParityChecker($propertyAccessor, $propertyInfoExtractor);
```

### Check your objects

[](#check-your-objects)

```
$errors = $parityChecker->checkParity([$object1, $object2]);
if (! $errors->hasErrors()) {
    // You're all set !
}
```

Usages
------

[](#usages)

### Options

[](#options)

```
$errors = $parityChecker->checkParity([$object1, $object2], [
    // Do not perform check on these types
    'ignore_types' => ['object', 'resource', \DateTimeInterface::class, '$objectProperty1'],

    // Perform check only on these types
    'only_types' => ['string', 'float'],

    // Perform a loose check ('==' instead of '===') on theses types
    'loose_types' => 'array',

    // Set the recursion limit for objects
    'deep_object_limit' => 0,

    // Set DateTime format to check
    'datetime_check_format' => false,

    // Set DateInterval format to check
    'date_interval_format' => '%R %Y %M %D %H %I %S %F',

    // Set DateTime zone mapping to name
    'datetime_zone' => true,

    // Set a data mapper closure
    'data_mapper' => [
        'my-mapper' => new ParityCheckerCallback(
            'array',
            fn ($value, string $property, array $options): mixed => $value['something'],
        ),
    ],

    // Custom checkers. You can set you own checker which replace other.
    'custom_checkers' => [
        'my-checker' => new ParityCheckerCallback(
            ['$property'],
            fn ($value1, $value2, string $property, array $options): bool => true,
        ),
    ],
]);
```

OptionDescriptionAccepted typesDefault values`ignore_types`Do not perform check on these types`string[]|string`. Can be any types. Checked by the `is_` functions, classes/interfaces names or object properties (must be prefixed by `$`)`object``only_types`Perform checks only on these types. `ignore_types` is evaluated before, so if you set the same type in both `ignore_types` and `only_types`, the type will be ignored.`string[]|string`. Can be any types. Checked by the `is_` functions, classes/interfaces names or object properties (must be prefixed by `$`)none`loose_types`On which type to perform loose check (`==`) instead of (`===`)`string[]|string`. Can be any types. Checked by the `is_` functions, classes/interfaces names or object properties (must be prefixed by `$`)none`deep_object_limit`The object recursion limit`int``0``data_mapper`Replace value before checking by your closure`ParityCheckCallbackInterface[]``datetime_check_format`, `date_interval_format`, `datetime_zone` mappers`datetime_check_format`The format that `DateTime` must be check with`bool|string`. Has to be a [valid DateTime format](https://www.php.net/manual/en/datetime.format.php). If it's `true`, `Y-m-d H:i:s` is used.`true``date_interval_format`The format that `DateInterval` must be check with`bool|string`. Has to be a [valid DateInterval format](https://www.php.net/manual/en/dateinterval.format.php). If it's true, `%R %Y %M %D %H %I %S %F` is used.`true``datetime_zone`Map `DateTimeZone` objects to its timezone name in order to check it. E.g `Europe/Paris``bool``true``custom_checkers`You can set you own checker which replace other`ParityCheckCallbackInterface[]`none### Errors

[](#errors)

```
$errors = $parityChecker->checkParity([$object1, $object2], $options);

if ($errors->hasError()) {
    foreach ($errors as $error) {
        $property = $error->getProperty();
        $object1 = $error->getObject1();
        $object2 = $error->getObject2();

        $errorValue1 = $error->getObject1Value();
        $errorValue2 = $error->getObject2Value();
    }
}
```

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance65

Regular maintenance activity

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 72.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Recently: every ~67 days

Total

8

Last Release

1341d ago

Major Versions

v1.4.1 → v2.0.02022-09-05

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce2276bdc3eeb394bfbb7aa55f92e43ab708da844a860d52b4740887ce597841?d=identicon)[benjaminmal](/maintainers/benjaminmal)

---

Top Contributors

[![benjaminmal](https://avatars.githubusercontent.com/u/58468686?v=4)](https://github.com/benjaminmal "benjaminmal (64 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (19 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (5 commits)")

---

Tags

php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/benjaminmal-parity-checker/health.svg)

```
[![Health](https://phpackages.com/badges/benjaminmal-parity-checker/health.svg)](https://phpackages.com/packages/benjaminmal-parity-checker)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[symfony/serializer-pack

A pack for the Symfony serializer

1.1k28.2M219](/packages/symfony-serializer-pack)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
