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

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

cora/collection
===============

Keep collections of data with flexible access methods.

v1.0.1(6y ago)041MITPHPPHP &gt;=5.3.0

Since Aug 14Pushed 6y ago1 watchersCompare

[ Source](https://github.com/joebubna/cora-collection)[ Packagist](https://packagist.org/packages/cora/collection)[ RSS](/packages/cora-collection/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (3)Used By (1)

Cora Collection
===============

[](#cora-collection)

Basic Usage
-----------

[](#basic-usage)

### Flexible interface that allows you to use your favorite format

[](#flexible-interface-that-allows-you-to-use-your-favorite-format)

```
$collection = new \Cora\Collection();
$collection->add('Hello World');
echo $collection->get(0);       // Outputs "Hello World"
echo $collection[0];            // Outputs "Hello World"
echo $collection->get("off0");  // Outputs "Hello World"
echo $collection->off0;         // Outputs "Hello World"
```

### Easily filter contents using WHERE method

[](#easily-filter-contents-using-where-method)

```
$collection = new \Cora\Collection([
    new \Classes\Event('Debit', '10/10/1980'),
    new \Classes\Event('Debit', '10/10/2001'),
    new \Classes\Event('Deposit', '02/14/2008'),
    new \Classes\Event('Debit', '10/10/1990'),
    new \Classes\Event('Debit', '10/10/2003'),
    new \Classes\Event('Deposit', '02/14/2004')
]);
$this->assertEquals(6, $collection->count());
$this->assertEquals(4, count($collection->where('name', 'Debit')));
$this->assertEquals(2, count($collection->where('name', 'Deposit')));
$this->assertEquals(4, count($collection->where('timestamp', new \DateTime('01/01/2000'), '>=')));
```

### Can set an object property or associative array key as the primary for access

[](#can-set-an-object-property-or-associative-array-key-as-the-primary-for-access)

Here we pass in "name" as the second constructor argument:

```
$collection = new \Cora\Collection([
    new \Classes\User('User1', 'Type1'),
    new \Classes\User('User2', 'Type1'),
    new \Classes\User('User3', 'Type2'),
    new \Classes\User('User4', 'Type2'),
    new \Classes\User('User5', 'Type1'),
    new \Classes\User('User6', 'Type3')
], 'name');

$this->assertEquals('User3', $collection->User3->name);
$this->assertEquals('Type2', $collection->User3->type);
$this->assertEquals('Type2', $collection->get('User3')->type);
```

### And more...

[](#and-more)

Supports merging, mapping, filtering, sorting, grouping, min, max, sum, count, etc.

Running Tests
-------------

[](#running-tests)

If you have Docker, you can download the project and `docker-compose up` from the command line. Then run `./App/phpunit.sh tests` from the command line.

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

[](#documentation)

For complete documentation please see the GitHub pages website here:

About Cora
----------

[](#about-cora)

Cora is a set of flexible tools for rapid app development.

License
-------

[](#license)

The Cora framework is licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

2512d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2198762?v=4)[Josiah Bubna](/maintainers/joebubna)[@joebubna](https://github.com/joebubna)

---

Tags

phparraycollectionlistdemogroupcora

### Embed Badge

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

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

###  Alternatives

[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.3k459.4k15](/packages/aimeos-map)[graze/sort

A collection of array sorting transforms and functions

11298.3k2](/packages/graze-sort)[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.

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

PHPackages © 2026

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