PHPackages                             grifart/equalable-utils - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. grifart/equalable-utils

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

grifart/equalable-utils
=======================

Provides a universal equals() function.

v1.0.4(1y ago)018.3k↓57.6%[1 issues](https://github.com/grifart/equalable-utils/issues)1MITPHPPHP ^8.2

Since Nov 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/grifart/equalable-utils)[ Packagist](https://packagist.org/packages/grifart/equalable-utils)[ RSS](/packages/grifart-equalable-utils/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (6)Used By (1)

Equalable utils
===============

[](#equalable-utils)

Are objects equal or not? PHP defines only instance equality using `===` operator. Then there is comparision by value `==` which compares by object values, but user-land code cannot modify how they are compared.

This is why universal [`equals()` method exists in Java](https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)). PHP is missing anything like that.

This is why I have implemented global `equals()` function provides logic equality of objects. Which objects are equal and which not can be modified by several things - see bellow.

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

[](#installation)

```
composer require grifart/equalable-utils
```

Implementing logical equality
-----------------------------

[](#implementing-logical-equality)

There are several ways of implementhing logic equality.

### `\Ds\Hashable` (from PHP DS extension)

[](#dshashable-from-php-ds-extension)

[Hashable](http://php.net/manual/en/class.ds-hashable.php) is PHP clone of Java `equals()` and `hashCode()` method. If you like to use implementing objects in collection this would make the most sense.

### `\Comparable` interface proposal

[](#comparable-interface-proposal)

This library supports [`\Comparable`](https://github.com/grifart/comparable-polyfill) interface and tries to compare objects.

### Just implement equals($other), is($other) or isEqualTo($other) methods

[](#just-implement-equalsother-isother-or-isequaltoother-methods)

This methods must behave the same as [Java `equals()` method](https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)).

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance40

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% 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 ~659 days

Total

5

Last Release

506d ago

PHP version history (2 changes)v1.0.0PHP &gt;= 7.1.0

v1.0.4PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/133822?v=4)[Jan Kuchař](/maintainers/jkuchar)[@jkuchar](https://github.com/jkuchar)

---

Top Contributors

[![jkuchar](https://avatars.githubusercontent.com/u/133822?v=4)](https://github.com/jkuchar "jkuchar (8 commits)")[![jiripudil](https://avatars.githubusercontent.com/u/1042159?v=4)](https://github.com/jiripudil "jiripudil (6 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/grifart-equalable-utils/health.svg)

```
[![Health](https://phpackages.com/badges/grifart-equalable-utils/health.svg)](https://phpackages.com/packages/grifart-equalable-utils)
```

###  Alternatives

[florianwolters/component-util-singleton

The Singleton (and Registry of Singletons a.k.a. Multiton) design pattern as a PHP component.

13179.3k5](/packages/florianwolters-component-util-singleton)

PHPackages © 2026

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