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

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

mohamedahmed00/coollection
==========================

Laravel Illuminate collection with objectified properties

02PHP

Since Sep 24Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#coollection)

 [![Latest Stable Version](https://camo.githubusercontent.com/4153379119236436d9bc0dd40afa84b54e9195ceaf28e0b123b35056f4b88e93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f68616d656461686d656430302f636f6f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mohamedahmed00/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/61b55b1d59faecb22a613c1a4a021a6f6c4339f29ff26f44a430ec5739e1feca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f68616d656461686d656430302f636f6f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mohamedahmed00/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 mohamedahmed00/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

14

—

LowBetter than 2% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 96.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/095ee77df4acbc191a1f199c7c2cf07162249480b459bb839193dccb7915793e?d=identicon)[engmohamedahmed00](/maintainers/engmohamedahmed00)

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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