PHPackages                             pragmarx/coollection - 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. pragmarx/coollection

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

pragmarx/coollection
====================

Laravel Illuminate collection with objectified properties

v0.8.1(3y ago)943.4M—3.6%27[1 issues](https://github.com/antonioribeiro/coollection/issues)11MITPHPPHP &gt;=7.0

Since Oct 29Pushed 1y ago5 watchersCompare

[ Source](https://github.com/antonioribeiro/coollection)[ Packagist](https://packagist.org/packages/pragmarx/coollection)[ Docs](https://github.com/antonioribeiro/coollection)[ RSS](/packages/pragmarx-coollection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (27)Used By (11)

Coollection
===========

[](#coollection)

 [![Latest Stable Version](https://camo.githubusercontent.com/d7f656409295237a70f26eb54ae2f3a4d0f285c43fba3ded19ed453c3338661a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f707261676d6172782f636f6f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pragmarx/coollection) [![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE) [![Code Quality](https://camo.githubusercontent.com/36e98d3582aa8f292edadd4b7ff5da690882174951a5afa3a91cef9dd31130e6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616e746f6e696f7269626569726f2f636f6f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/antonioribeiro/coollection/?branch=master) [![Build](https://camo.githubusercontent.com/55273df04104aa7c879e05a60e954067ac0252f8a1e66f06a3a0526c072f7a0f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616e746f6e696f7269626569726f2f636f6f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/antonioribeiro/coollection) [![Downloads](https://camo.githubusercontent.com/7461db21b4eb9049f9b24f975e99997fad38b2265725199c956541d911ec216c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f707261676d6172782f636f6f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pragmarx/coollection)

 [![Coverage](https://camo.githubusercontent.com/318499dc7997572d382d4bb73925eff2496b69d64692265a558803558d1222e0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f616e746f6e696f7269626569726f2f636f6f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/antonioribeiro/coollection/?branch=master) [![StyleCI](https://camo.githubusercontent.com/4fc50f0e43f311a3a0f7e8653f78145c6e10b29918e7a4b8d9261f32cd194075/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130383630323137382f736869656c64)](https://styleci.io/repos/108602178) [![PHP](https://camo.githubusercontent.com/5ba5918c23b3078d4ed1bc9c4c6dc152f1e279639ceb34b7e1940bc9645e0fc2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e302532302d2d253230372e332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/antonioribeiro/coollection)

#### Access collection items as objects properties

[](#access-collection-items-as-objects-properties)

Coollection is [Laravel's Illuminate\\Collection](https://laravel.com/docs/5.5/collections) repackaged to be used as all properties were objects:

```
$collection->name

$collection->addresses->first()->street_name

$collection->flatten()->cars->filter(function($car) { return $car->name == 'ferrari' })->last()->model

$countries->where('name.common', 'United States')->first()->currency->name->english;
```

#### Tightenco\\Collect

[](#tightencocollect)

To be agnostic and have complete idependence from Laravel's, but also to allow it to be used in Laravel applications, this package extends [Tightenco\\Collect](https://github.com/tightenco/collect), developed by [Matt Stauffer](https://twitter.com/stauffermatt) from [Tighten](https://twitter.com/tightenco).

Why?
----

[](#why)

#### Answering with a question: which one is easier to look at?

[](#answering-with-a-question-which-one-is-easier-to-look-at)

```
collect(
    collect(
        collect(
            collect(
                $collection['cars']
            )->unique('constructor')['models']
        )->last()['model']
    )['colors']
)->first()['rgb']
```

or

```
$collection->cars->unique('constructor')->last()->model->colors->first()->rgb
```

#### Isn't this easier on the eyes?

[](#isnt-this-easier-on-the-eyes)

```
collect($vimeo)->body->data->first()->metadata->connections->likes->total;
```

Or you prefer this one?

```
collect($vimeo)['body']['data'][0]['metadata']['connections']['likes']['total'];
```

#### Used with Laravel request it is useful, if you receive:

[](#used-with-laravel-request-it-is-useful-if-you-receive)

```
{"pagination":{"perPage":100,"pageNumber":1}}
```

You `collect()` it:

```
$input = coollect($request->all());
```

And you can just:

```
$input->pagination->perPage
```

Instead of:

```
$input->get('pagination')['perPage']
```

You can also use "dot notation" to get your items:

```
$input->get('pagination.perPage')
```

PHP Agnostic
------------

[](#php-agnostic)

This is an agnostic PHP package, an extraction of Illuminate\\Support\\Collection with all needed classes, interfaces and traits. For that if you wish just to use Illuminate's Collection, you just have to import the class Collection:

```
$collection = new IlluminateExtracted\Support\Collection(['my collection']);
```

or use the usual helper:

```
$collection = collect(['my collection']);
```

Documentation
-------------

[](#documentation)

It's Laravel's Collection, at full power, so you can check [its docs](https://laravel.com/docs/5.6/collections). The only difference is that you can access items (array keys) as properties, like any other PHP object:

```
$collection->map($mapper)->reduce($reducer)->random()->address->street

$this->sendThanks(
    $collection->where('full_name', 'Barack Obama')->addresses->random()
);

$countries->where('name.common', 'United States')->first()->currency->symbol;
```

Install
-------

[](#install)

Via Composer

```
$ composer require pragmarx/coollection
```

Usage
-----

[](#usage)

Instantiate, the class directly or using the helper:

```
$c = new Coollection(['first_name' => 'Barack Obama']);

$c = coollect(['first_name' => 'Barack Obama']);
```

Then you use it as an object:

```
echo $c->first_name;

// Barack Obama

echo $c->flip()->barak_obama == 'first_name'
    ? 'true'
    : 'false';

// true
```

One word keys are case insensitive:

```
echo $c->rio;
echo $c->RIO;
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- This package is an extension of [Tightenco\\Collect](https://github.com/tightenco/collect), developed by [Matt Stauffer](https://twitter.com/stauffermatt) from [Tighten](https://twitter.com/tightenco).
- [Tightenco\\Collect](https://github.com/tightenco/collect) is an extraction of The Laravel Framework's Collection, created by [Taylor Otwell](https://twitter.com/taylorotwell).
- Package creator [Antonio Carlos Ribeiro](https://twitter.com/iantonioribeiro)
- [Contributors](https://github.com/antonioribeiro/ia-str/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity57

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.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 ~71 days

Recently: every ~317 days

Total

26

Last Release

1349d ago

PHP version history (3 changes)v0.1.0PHP ~7.0

v0.1.1PHP &gt;=7.0

v0.5.1PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9421a69d192db597169ec3519ad3efc6a35a660e4525e2ed08f6c753b908e86?d=identicon)[AntonioCarlosRibeiro](/maintainers/AntonioCarlosRibeiro)

---

Top Contributors

[![antonioribeiro](https://avatars.githubusercontent.com/u/3182864?v=4)](https://github.com/antonioribeiro "antonioribeiro (147 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

---

Tags

collecionlaravellaravel-collectionsphplaravelcollectionpragmarx

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pragmarx-coollection/health.svg)

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

###  Alternatives

[pragmarx/ia-collection

Laravel Illuminate Agnostic Collection

473.4M2](/packages/pragmarx-ia-collection)[pragmarx/ia-arr

Laravel Illuminate Agnostic Arr

553.6M12](/packages/pragmarx-ia-arr)[armincms/json

A Laravel Nova field.

25149.4k3](/packages/armincms-json)[lazerg/laravel-enum-pro

A powerful PHP enum extension with collection support, random selection, and magic static calls

4319.0k](/packages/lazerg-laravel-enum-pro)[werxe/laravel-collection-macros

Custom Laravel Collection macros.

2625.8k](/packages/werxe-laravel-collection-macros)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)

PHPackages © 2026

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