PHPackages                             bettrlife/weak-collections - 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. bettrlife/weak-collections

ActiveLibrary

bettrlife/weak-collections
==========================

Collections of transparent weak references (for caching, etc.).

047PHP

Since Nov 12Pushed 10y ago2 watchersCompare

[ Source](https://github.com/BettrLife/weak-collections)[ Packagist](https://packagist.org/packages/bettrlife/weak-collections)[ RSS](/packages/bettrlife-weak-collections/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Weak Collections for PHP
========================

[](#weak-collections-for-php)

class WeakArray
---------------

[](#class-weakarray)

Implements an array of where the values are always a weak reference in the array. In other words, this is an array you can stick things in without forcing those objects to stay alive. If the object becomes invalid, so too does the key.

Useful for things like keeping a cache of database objects, so if two things ask for the same ID, you can give them the same underlying object without causing the object to stay in memory unnecessarily.

Contrast this with WeakMap, which attaches arbitrary data to a weakly-referenced key.

Bonus
-----

[](#bonus)

The optional-weakref branch provides compatibility shims for WeakRef and WeakMap, so you can develop against the weakref PECL extension without installing it everywhere (with the hopefully-obvious caveat that without the weakref extension, all references are strong).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/28968debd70ae4c8d47293bf0b93ff92dde0b2fe0c6d0bd62603af65672d9f20?d=identicon)[mjhoag](/maintainers/mjhoag)

---

Top Contributors

[![mjhoag](https://avatars.githubusercontent.com/u/6718167?v=4)](https://github.com/mjhoag "mjhoag (6 commits)")

### Embed Badge

![Health badge](/badges/bettrlife-weak-collections/health.svg)

```
[![Health](https://phpackages.com/badges/bettrlife-weak-collections/health.svg)](https://phpackages.com/packages/bettrlife-weak-collections)
```

PHPackages © 2026

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