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

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

sharkzt/collections
===================

Generic-like collections for php, inspired by OOP languages structures

0.1.0(8y ago)05MITPHPPHP &gt;=7.1.0

Since Oct 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Sharkzt/Collections)[ Packagist](https://packagist.org/packages/sharkzt/collections)[ Docs](https://github.com/Sharkzt/Collections)[ RSS](/packages/sharkzt-collections/feed)WikiDiscussions master Synced today

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

Collections
===========

[](#collections)

**Collections** for php, inspired by OOP generic languages structures

[![Build Status](https://camo.githubusercontent.com/22132efea479b473642e1e4b40b613170e41902363f69d023334f642ffb858c1/68747470733a2f2f7472617669732d63692e6f72672f536861726b7a742f436f6c6c656374696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Sharkzt/Collections)[![Coverage Status](https://camo.githubusercontent.com/22520025677d0f726f656dc5e0ac5696915653d7dbd64f8d8513f59b13d93ebf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f536861726b7a742f436f6c6c656374696f6e732f62616467652e737667)](https://coveralls.io/github/Sharkzt/Collections)

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

[](#installation)

The recommended way to install bundle is through [Composer](http://getcomposer.org/):

```
$ composer require sharkzt/collections
```

Usage Examples
--------------

[](#usage-examples)

### ArrayList

[](#arraylist)

```
//rough example of ArrayListcreation, usually goes in constructor; see examples classes
$user = new User();
$user->articles = new ArrayList(Article::class);
```

ArrayList will accept only Article instances as arguments.

```
//addAll argument can be any iterable form, like ArrayList
$user->articles->addAll([
    (new Article())
        ->setTitle('foo')
        ->setContent('bar'),
    (new Article())
        ->setTitle('baz')
        ->setContent('qux'),
]);

$singleArticle = (new Article())
    ->setTitle('foo')
    ->setContent('bar');
$user->articles->add($singleArticle);
```

Can add iterable articles, or single invoking add method.

```
if ($user->articles->contains($singleArticle)) {
    $user->articles->remove($singleArticle);
}

foreach ($user->articles as $article) {
    if ($article->getContent() === 'qux') {
        $article->setTitle('foo');
        break;
    }
}
```

Possible usage examples.

License
-------

[](#license)

Collections classes are released under the MIT License. See the bundled LICENSE file for details.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

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

3129d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b4ac1560f5a798a74d76a0dd6be171299458a675e419013c772c227bf306f43?d=identicon)[Sharkzt](/maintainers/Sharkzt)

---

Top Contributors

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

---

Tags

collectionsoopphpphpcollections

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[ilya/belt

A handful of tools for PHP developers.

71020.8k1](/packages/ilya-belt)[cartalyst/collections

Collection Abstaction library for PHP.

76908.6k3](/packages/cartalyst-collections)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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