PHPackages                             maxalmonte14/phpcollections - 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. maxalmonte14/phpcollections

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

maxalmonte14/phpcollections
===========================

A set of collections for PHP.

v1.3.0(7y ago)5811331MITPHPPHP &gt;=7.2

Since Nov 2Pushed 7y ago4 watchersCompare

[ Source](https://github.com/maxalmonte14/phpcollections)[ Packagist](https://packagist.org/packages/maxalmonte14/phpcollections)[ RSS](/packages/maxalmonte14-phpcollections/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (2)Versions (10)Used By (1)

[![StyleCI](https://camo.githubusercontent.com/3f0477780fe216dbbf946fe57af9925c4734992e7a853b28d7cb5b67595f84f1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3130363434343331302f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/106444310)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2cff75114c0e8f32d03303b7c92c4925972e5f0d00bc61153350716173d207b4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6178616c6d6f6e746531342f706870636f6c6c656374696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maxalmonte14/phpcollections/?branch=master)[![Build Status](https://camo.githubusercontent.com/28e07d9ab2f05675fa6f42766ddae433a55c8efb599c5a8372e792dc59fa1948/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6178616c6d6f6e746531342f706870636f6c6c656374696f6e732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maxalmonte14/phpcollections/build-status/master)

About PHPCollections
--------------------

[](#about-phpcollections)

PHPCollections is a set of data structures that try to make your life easier when you're working with PHP and large sets of data. Inspired by languages like Java or C#, PHPCollections offers data structures like List, Map, Stack and more, check it out!

Requirements
------------

[](#requirements)

```
PHP >= 7.2

```

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

[](#installation)

```
composer require "maxalmonte14/phpcollections"

```

Examples
--------

[](#examples)

Imagine you're storing Post objects for fetching like so.

```
$posts[] = new Post(1, 'PHP 7.2 release notes');
$posts[] = new Post(2, 'New Laravel 5.5 LTS make:factory command');
```

Everything is fine! But maybe you made a mistake for some mysterious reason and added a non-Post object.

```
$posts[] = 5 // This is not even an object!
```

When you'll try to fetch your posts array you'll be in troubles.

```

        id; ?>
        title; ?>

```

Fortunately PHPCollections exists.

```
$posts = new GenericList(
    Post::class,
    new Post(1, 'PHP 7.2 release notes'),
    new Post(2, 'New Laravel 5.5 LTS make:factory command')
);
$posts->add(5); // An InvalidArgumentException is thrown!
```

Of course there exist more flexible data structures like ArrayList.

```
$posts = new ArrayList();
$posts->add(new Post(1, 'PHP 7.2 release notes'));
$posts->add(new Post(2, 'New Laravel 5.5 LTS make:factory command'));
$posts->add(5); // Everything is fine, I need this 5 anyway
```

Features
--------

[](#features)

- Different types of collections like Dictionary, Stack and GenericList.
- Simple API.
- Lightweight, no extra packages needed.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 95.7% 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 ~63 days

Recently: every ~13 days

Total

7

Last Release

2734d ago

Major Versions

v0.7.0 → v1.0.02018-10-04

PHP version history (3 changes)v0.5.0PHP &gt;=7.0

v0.6.0PHP &gt;=7.1

v1.1.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/813e041671ebc0668cdc0280245483d16775a3ae2ba202632d0235be3f3faec1?d=identicon)[maxalmonte14](/maintainers/maxalmonte14)

---

Top Contributors

[![maxalmonte14](https://avatars.githubusercontent.com/u/12385704?v=4)](https://github.com/maxalmonte14 "maxalmonte14 (111 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (2 commits)")[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (2 commits)")[![samnela](https://avatars.githubusercontent.com/u/1852108?v=4)](https://github.com/samnela "samnela (1 commits)")

---

Tags

arraylistcollectioncollectionsdictionarygenericpairphpphp-libraryphp7stackphpstackcollectioncollectionsgenericdictionaryPHP7PHP Libraryarraylistpair

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maxalmonte14-phpcollections/health.svg)

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

###  Alternatives

[cartalyst/collections

Collection Abstaction library for PHP.

76908.6k4](/packages/cartalyst-collections)

PHPackages © 2026

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