PHPackages                             dashifen/collection - 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. dashifen/collection

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

dashifen/collection
===================

An abstract object from which concrete collections can be built.

3.0.0(2y ago)05.2k2MITPHPPHP &gt;=8.2

Since Jan 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dashifen/collection)[ Packagist](https://packagist.org/packages/dashifen/collection)[ RSS](/packages/dashifen-collection/feed)WikiDiscussions release Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (8)Used By (2)

Dashifen/Collection
===================

[](#dashifencollection)

An abstract object from which concrete collections can be built.

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

[](#installation)

`composer require dashifen/collection`

Usage
-----

[](#usage)

Included herein is an abstract class, `AbstractCollection` which implements a `CollectionInterface`. That interface extends both `Iterator` and `ArrayAccess`, the methods of which are implemented by `AbstractCollection`. Thus, extending this object for your own purposes will allow you to create your own collection that responds like an array within `foreach` loops and can be accessed using the `[]` operator.

### Example

[](#example)

While the `AbstractCollection` object implements all of the methods of its interface, it may be beneficial to override some of them in order to type hint parameters and return values throughout. In the following example, we assume a `Movie` object has been defined and that the indices within our collection of movies are their titles, i.e. the collection is an associative array.

```
class MovieCollection implements AbstractCollection
{
    public function current(): Movie
    {
        return current($this->collection);
    }

    public function key(): ?string
    {
        return key($this->collection);
    }

    public function valid(): bool
    {
        return is_string($this->key());
    }

    public function offsetGet ($offset): ?Movie
    {
        return $this->collection[$offset] ?? null;
    }

    public function offsetSet ($offset, $value): void
    {
        if (!($value instanceof Movie)) {
            throw new Exception('Collection value must be a Movie');
        }

        $this->collection[$offset] = $value;
    }
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 85.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 ~266 days

Recently: every ~282 days

Total

6

Last Release

989d ago

Major Versions

1.0.0 → 2.0.02020-07-29

2.1.0 → 3.0.02023-09-02

PHP version history (3 changes)1.0.0PHP &gt;=7.1

2.0.0PHP &gt;=7.4

3.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8269?v=4)[David Dashifen Kees](/maintainers/dashifen)[@dashifen](https://github.com/dashifen)

---

Top Contributors

[![dashifen](https://avatars.githubusercontent.com/u/8269?v=4)](https://github.com/dashifen "dashifen (6 commits)")[![dashifen-gu](https://avatars.githubusercontent.com/u/50078554?v=4)](https://github.com/dashifen-gu "dashifen-gu (1 commits)")

### Embed Badge

![Health badge](/badges/dashifen-collection/health.svg)

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

###  Alternatives

[abelzhou/php-trie-tree

Make a trie tree with php language.

21717.9k1](/packages/abelzhou-php-trie-tree)[doublesecretagency/craft-spoon

Bend your Matrix fields with block groups &amp; tabs.

8225.6k](/packages/doublesecretagency-craft-spoon)[robotusers/cakephp-excel

Robotusers CakePHP Excel plugin

2312.1k](/packages/robotusers-cakephp-excel)[plenta/contao-jobs-basic-bundle

Basic Job Manager for Contao (including Google Jobs).

335.1k](/packages/plenta-contao-jobs-basic-bundle)[timwassenburg/filament-timesheets

Filament Timesheets is a package for Filament that allows you to track time spent on projects and tasks.

471.1k1](/packages/timwassenburg-filament-timesheets)

PHPackages © 2026

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