PHPackages                             jkhaled/equatable - 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. jkhaled/equatable

ActiveLibrary

jkhaled/equatable
=================

interface to compare object based on properties

v1.0.0(4y ago)16MITPHP

Since Feb 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hdimo/php-equtable)[ Packagist](https://packagist.org/packages/jkhaled/equatable)[ RSS](/packages/jkhaled-equatable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

[![PHP UNIT](https://github.com/hdimo/php-equtable/actions/workflows/php.yml/badge.svg)](https://github.com/hdimo/php-equtable/actions/workflows/php.yml)

An equatable interface for object comparison in PHP.

when we want to compare objects in php with == yields incorrect results even if they are equal in all properties. this library provides an interface to compare two objects by returning their properties and checks if they are equal.

Installation

```
composer require jkhaled/equatable
```

usage example :

```
require_once __DIR__ . '/vendor/autoload.php';

class User extends \Jkhaled\Equatable\AbstractEquatable
{
    private $id;
    private $firstname;

    public function getId()
    {
        return $this->id;
    }

    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }

    public function getFirstname()
    {
        return $this->firstname;

    }

    public function setFirstname($firstname)
    {
        $this->firstname = $firstname;
        return $this;
    }

    // the properties to be compared to check equality
    public function getProperties(): array
    {
        return ['id', 'firstname'];
    }
}

$user1 = (new User())
    ->setFirstname('khaled')
    ->setId(111);

$user2 = (new User())
    ->setFirstname('khaled')
    ->setId(111);

var_dump($user1 === $user2); // false
var_dump($user1->equalTo($user2)); // true
```

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1552d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/001ad3b9adbf63b5c6922f5d3acde7fab0edaac11dd2a8e67279641bbd85cf36?d=identicon)[jkhaled](/maintainers/jkhaled)

---

Top Contributors

[![hdimo](https://avatars.githubusercontent.com/u/2865108?v=4)](https://github.com/hdimo "hdimo (18 commits)")

---

Tags

equatablephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jkhaled-equatable/health.svg)

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

PHPackages © 2026

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