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

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

tebru/php-collections
=====================

Data structures for PHP based on Java Collection Framework

v0.3.2(9y ago)279↓100%2MITPHPPHP &gt;= 7.1

Since Oct 12Pushed 6y ago1 watchersCompare

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

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

PHP Collections
===============

[](#php-collections)

[![Build Status](https://camo.githubusercontent.com/21998c3e12db937bc1b9eaa2d8becf57c6ee3c134caef03473753044a86adf2d/68747470733a2f2f7472617669732d63692e6f72672f74656272752f7068702d636f6c6c656374696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tebru/php-collections)[![Code Coverage](https://camo.githubusercontent.com/2055dd0715109f7d824883cb035a6091d774b441134d0f0b771d18ab168ad7a3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74656272752f7068702d636f6c6c656374696f6e732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tebru/php-collections/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/140100c93df44cbec05e81705fa9f5801e2ce632d373002d676719a41f5937df/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74656272752f7068702d636f6c6c656374696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tebru/php-collections/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/95775369d980abc8af8a6d1753b3f15d4c80719b0ca46533598ce57b5eab8f2a/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30626539313335352d323862302d343239332d393736662d3564323763396365306339302f6d696e692e706e67)](https://insight.sensiolabs.com/projects/0be91355-28b0-4293-976f-5d27c9ce0c90)

This library ports the Java Collections Framework to PHP.

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

[](#installation)

```
composer require tebru/php-collections

```

Collections
-----------

[](#collections)

Collections provide data storage where order and random access do not matter. All collections implement `CollectionInterface`.

### AbstractCollection

[](#abstractcollection)

This is an abstract class that implements the methods it can. It defers the decision of what underlying data structure to use to the concrete implementation.

### Bag

[](#bag)

This is an implementation of `CollectionInterface` that extends from `AbstractCollection` and uses an array as data storage.

### AbstractList

[](#abstractlist)

This inherits from `AbstractCollection` and implements the `ListInterface`. Lists add random access to collections. The allow getting/setting/removing at a specific index. By default, they add elements to the end of the list.

### ArrayList

[](#arraylist)

This is an implementation of `CollectionInterface` and `ListInterface`. It extends from `AbstractList` and uses an array as data storage.

### AbstractSet

[](#abstractset)

This extends from `AbstractCollection` and implements `SetInterface`. Sets differ from generic collections by only allowing one of each element.

### HashSet

[](#hashset)

This is an implementation of `CollectionInterface` and `SetInterface` and extends from `AbstractSet`. This uses a `HashMap` as data storage.

Maps
----

[](#maps)

Maps provide data storage where order does not matter, but the ability to get a value by key is important. All maps implement `MapInterface`.

### AbstractMap

[](#abstractmap)

This implements `MapInterface` and implements any methods that do not need to know about the specific data storage.

### HashMap

[](#hashmap)

This is an implementation of `MapInterface` and extends from `AbstractMap`. It uses an array as data storage.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.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 ~15 days

Recently: every ~23 days

Total

7

Last Release

3400d ago

PHP version history (2 changes)v0.1.0PHP &gt;= 7.0

v0.3.0PHP &gt;= 7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1831497?v=4)[Nate Brunette](/maintainers/natebrunette)[@natebrunette](https://github.com/natebrunette)

---

Top Contributors

[![natebrunette](https://avatars.githubusercontent.com/u/1831497?v=4)](https://github.com/natebrunette "natebrunette (49 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tebru-php-collections/health.svg)

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

###  Alternatives

[riipandi/laravel-optikey

Use UUID, Ulid, or nanoid as optional or primary key in Laravel.

429.1k](/packages/riipandi-laravel-optikey)

PHPackages © 2026

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