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

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

pogulailo/collection
====================

Strictly typed collection

v1.0.0(3y ago)415Apache-2.0PHP

Since Sep 13Pushed 2y ago2 watchersCompare

[ Source](https://github.com/pogulailo/collection)[ Packagist](https://packagist.org/packages/pogulailo/collection)[ RSS](/packages/pogulailo-collection/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Collection
==========

[](#collection)

A simple and concise implementation of strictly typed arrays in PHP. No extra code, just type-checked arrays.

Usage
-----

[](#usage)

First you need to create your own collection class which extends the `GenericCollection` and sets its type:

```
use Pogulailo\Collection\GenericCollection;

class CustomerCollection extends GenericCollection
{
    public function __construct(...$values)
    {
        parent::__construct(Customer::class, ...$values);
    }
}
```

That's all, then you can enjoy all the advantages of strictly typed arrays:

```
function getCustomers(): CustomerCollection
{
    $customers = new CustomerCollection();

    $customers->append(new Customer());
    $customers->append(new Customer());
    $customers->append(new Customer());

    return $customers;
}

function doSomething(CustomerCollection $customers): void
{
    foreach ($customers as $customer) {
        // Do what you need to do
    }
}

$customers = getCustomers();
doSomething($customers);
```

You can choose not to create your own collection class, but then you will need to do additional type checking:

```
use Pogulailo\Collection\GenericCollection;

function getCustomers(): GenericCollection
{
    $customers = new GenericCollection(Customer::class);

    $customers->append(new Customer());
    $customers->append(new Customer());
    $customers->append(new Customer());

    return $customers;
}

function doSomething(GenericCollection $customers): void
{
    // In this case, you need to check the collection type first
    if ($customers->getType() !== Customer::class) {
        throw new Exception('I need customers, more customers...')
    }

    foreach ($customers as $customer) {
        // Do what you need to do
    }
}

$customers = getCustomers();
doSomething($customers);
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

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

1339d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/400292573c5e08e5aa8af5c3ae3a2e9c9154b39bcb1bf6fb8d07d0cd989269c7?d=identicon)[pogulailo](/maintainers/pogulailo)

---

Top Contributors

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

---

Tags

collectionphp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[fntneves/laravel-transactional-events

Transaction-aware Event Dispatcher for Laravel

3202.6M2](/packages/fntneves-laravel-transactional-events)[ipinfo/ipinfo

The official PHP library for IPinfo, the most reliable, accurate, and in-depth source of IP address data available anywhere. We process terabytes of data to produce our custom IP geolocation, company, carrier and IP type data sets. Visit our developer docs at https://ipinfo.io/developers.

2891.2M11](/packages/ipinfo-ipinfo)[craftcms/plugin-installer

Craft CMS Plugin Installer

283.3M4](/packages/craftcms-plugin-installer)[typo3/cms-recordlist

TYPO3 CMS Recordlist - Lists database records in the TYPO3 backend module (Web&gt;List).

178.0M48](/packages/typo3-cms-recordlist)[broadway/uuid-generator

UUID generator for broadway/broadway.

202.1M11](/packages/broadway-uuid-generator)

PHPackages © 2026

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