PHPackages                             fleshgrinder/equalable - 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. fleshgrinder/equalable

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

fleshgrinder/equalable
======================

Interface for custom equality determination of objects.

1.0.0(9y ago)07181UnlicensePHPPHP ^7.0

Since Sep 22Pushed 9y agoCompare

[ Source](https://github.com/Fleshgrinder/php-equalable)[ Packagist](https://packagist.org/packages/fleshgrinder/equalable)[ RSS](/packages/fleshgrinder-equalable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/30924d91c129042d00ce74ecf9554232e1d8216a9499bcee2f5f544e62568bcd/68747470733a2f2f706f7365722e707567782e6f72672f666c6573686772696e6465722f657175616c61626c652f762f737461626c65)](https://packagist.org/packages/fleshgrinder/equalable)[![License](https://camo.githubusercontent.com/2103aaef8d6cc5b880b16e7a63edf0314bf65d42d502b86e293d5914688e0435/68747470733a2f2f706f7365722e707567782e6f72672f666c6573686772696e6465722f657175616c61626c652f6c6963656e7365)](https://packagist.org/packages/fleshgrinder/equalable)[![Total Downloads](https://camo.githubusercontent.com/05d005de7d996cf45121e152b8b7cc2d7d814bdae0ffedcef58e7f1e15b8feb3/68747470733a2f2f706f7365722e707567782e6f72672f666c6573686772696e6465722f657175616c61626c652f646f776e6c6f616473)](https://packagist.org/packages/fleshgrinder/equalable)

Equalable
=========

[](#equalable)

The **equalable** library provides a single interface that defines a method that implementing classes can use to provide custom equality determination. This is useful for value objects and entities alike, since the former might want to allow equality checks against scalar types, and the latter need to exclude all encapsulated values from the equality determination which are not part of their identity defining values.

- [Installation](#installation)
- [Usage](#usage)
- [Testing](#testing)

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

[](#installation)

Open a terminal, enter your project directory and execute the following command to add this package to your dependencies:

```
composer require fleshgrinder/equalable
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.

Usage
-----

[](#usage)

Simply implement the interface and the required `equals` method. The actual implementation of the method’s body depends on the use-case. Value objects for instance might want to allow equality checks against scalar types, e.g.:

```
final class UserId implements Equalable {
	private $uid;

	// ...

	public function equals($other): bool {
		if ($other instanceof $this) {
			$other = $other->uid;
		}

		return \is_int($other) && $this->uid === $other;
	}
}
```

Entities on the other hand want to exclude all encapsulated values which are not part of their identity defining values from the determination, e.g.:

```
final class User implements Equalable {
	private $uid;
	private $name;
	private $email;

	// ...

	public function equals($other): bool {
		return $other instanceof $this && $this->uid->equals($other->uid);
	}
}
```

Testing
-------

[](#testing)

There are not tests since this library provides a single interface, which obviously has no implementation.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~265 days

Total

3

Last Release

3361d ago

Major Versions

v0.1.0 → 1.0.02017-03-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/6680298143064cd3ac63c0097ef724d46f47221ae0990db445081c4e8a923e05?d=identicon)[Fleshgrinder](/maintainers/Fleshgrinder)

---

Top Contributors

[![Fleshgrinder](https://avatars.githubusercontent.com/u/1059453?v=4)](https://github.com/Fleshgrinder "Fleshgrinder (10 commits)")

---

Tags

coreequalityphp7

### Embed Badge

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

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

###  Alternatives

[dudapiotr/zftable

Flexible tool to generate table

7530.9k](/packages/dudapiotr-zftable)[mouadziani/xstate

State machine library to play with any complex behavior of your PHP objects

866.7k](/packages/mouadziani-xstate)[pugx/godfather

Strategy pattern component as library and symfony2 bundle

2538.7k1](/packages/pugx-godfather)[akhaled/livewire-sweetalert

Integration Sweetalert with Livewire

181.9k4](/packages/akhaled-livewire-sweetalert)

PHPackages © 2026

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