PHPackages                             harp-orm/identity-map - 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. harp-orm/identity-map

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

harp-orm/identity-map
=====================

Allow only identical objects

0.1.1(10y ago)122BSD-3-ClausePHP

Since Sep 3Pushed 10y ago2 watchersCompare

[ Source](https://github.com/harp-orm/identity-map)[ Packagist](https://packagist.org/packages/harp-orm/identity-map)[ RSS](/packages/harp-orm-identity-map/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Identity Map
============

[](#identity-map)

[![Build Status](https://camo.githubusercontent.com/5d8ddbbe18f3af3eb83d6137cdcfab4bbb7658412c0e73df3cac7e79d37db83f/68747470733a2f2f7472617669732d63692e6f72672f686172702d6f726d2f6964656e746974792d6d61702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/harp-orm/identity-map)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5c640716b8a0afcfb2d4ceb2c4716dd6c6154d56ddf79367652bd6cde5f90700/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686172702d6f726d2f6964656e746974792d6d61702f6261646765732f7175616c6974792d73636f72652e706e67)](https://scrutinizer-ci.com/g/harp-orm/identity-map/)[![Code Coverage](https://camo.githubusercontent.com/43945eaece1ef337ae9aaf4bf51d65e070eb82cf0a9abb823004fd463385a34b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686172702d6f726d2f6964656e746974792d6d61702f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/harp-orm/identity-map/)[![Latest Stable Version](https://camo.githubusercontent.com/6210c5da4a2beffb089d85faafddf50f0e2c01fd8466958f03ba120345ed777b/68747470733a2f2f706f7365722e707567782e6f72672f686172702d6f726d2f6964656e746974792d6d61702f762f737461626c652e706e67)](https://packagist.org/packages/harp-orm/identity-map)

This package allows having "canonical objects".

Usage
-----

[](#usage)

Assuming "new Item(1)" will have id of "1":

```
$map = new IdentityMap(function ($item) {
    return $item->getId();
});

$item1 = new Item(1);
$item2 = new Item(1);
$item3 = new Item(2);

echo $map->get($item1); // Will return item1
echo $map->get($item2); // Will return item1
echo $map->get($item3); // Will return item3
```

That way you can make sure items with the same key are the same physical objects

---

The closure argument that use pass to the identity map, needs to return the "unique key" for each product.

License
-------

[](#license)

Copyright (c) 2014-2015, Clippings Ltd. Developed by [Ivan Kerin](https://github.com/ivank) as part of [Clippings.com](https://clippings.com)

Under BSD-3-Clause license, read [LICENSE](LICENSE) file.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

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

Every ~371 days

Total

2

Last Release

3902d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/506129?v=4)[Harry Dobrev](/maintainers/hkdobrev)[@hkdobrev](https://github.com/hkdobrev)

---

Top Contributors

[![ivank](https://avatars.githubusercontent.com/u/4976?v=4)](https://github.com/ivank "ivank (9 commits)")

### Embed Badge

![Health badge](/badges/harp-orm-identity-map/health.svg)

```
[![Health](https://phpackages.com/badges/harp-orm-identity-map/health.svg)](https://phpackages.com/packages/harp-orm-identity-map)
```

###  Alternatives

[phamda/phamda

Auto-curried function library

1922.8k](/packages/phamda-phamda)

PHPackages © 2026

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