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

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

eden/collection
===============

Eden generic collection component

4.0.1(10y ago)015.1k5MITPHPPHP &gt;=5.4.1

Since Sep 24Pushed 10y ago12 watchersCompare

[ Source](https://github.com/Eden-PHP/Collection)[ Packagist](https://packagist.org/packages/eden/collection)[ Docs](http://eden-php.com)[ RSS](/packages/eden-collection/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (4)Versions (6)Used By (5)

[![logo](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67)](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67) Eden Collection
=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-eden-collection)

[![Build Status](https://camo.githubusercontent.com/6b6dbbf85346d62f64fe7d8890962a7d3bb18395d9293308f18b555c53cd41e2/68747470733a2f2f6170692e7472617669732d63692e6f72672f4564656e2d5048502f436f6c6c656374696f6e2e706e67)](https://travis-ci.org/Eden-PHP/Collection)
====================================================================================================================================================================================================================================================================

[](#)

- [Install](#install)
- [Introduction](#intro)
- [Contributing](#contributing)

====

Install
-------

[](#install)

`composer install eden/collection`

====

Introduction
------------

[](#introduction)

Manipulating table, matrix or multidimensional data in most cases can be expressed as a collection. Collections in *Eden* is defined loosely and as a utility class to help managing data in a controlled and chainable format. The basic setup of a collection is described in `Figure 1`.

**Figure 1. Setup**

```
$users = array(
	array(
		'user_name' => 'Chris',
		'user_email' => 'cblanquera@openovate.com',
		'user_location' => 'Manila, Philippines'
	),

	array(
		'user_name' => 'Dan',
		'user_email' => 'dmolina@openovate.com',
		'user_location' => 'Manila, Philippines'
	),
);

```

eden('collection', $users);

Collections do exactly the same thing as models except it manipulates multiple models instead. Collections can be iterable and access as arrays as well. Collections only hold model objects so if you wanted to use your own extended model, you would need to call `->setModel('Your_Model')`. From here we can access properties in our collection as a method, property or back as an array. `Figure 2` shows the ways to access data in action.

\*\*Figure 2. Accessing Collection, Models and Rows \*\*

```
//set user name for all rows
$collection->setUserName('Chris');

// set or get any abstract key for all rows
$collection->setAnyThing();

//collections are iterable
foreach($collection as $model) {
	echo $model->getUserName().' ';
	echo $model['user_email'];
}

//access as array
echo $collection[0]['user_name'];
//set as array
$collection[0]['user_email'] = 'my@email.com';

```

Some other utility methods not covered by th above examples are date formating and copying from one column to another. `Figure 3`, show how we would go about doing these things.

**Figure 3. Utility methods**

```
//for each row, copy the value of post_user to the user_id column
$collection->copy('post_user', 'user_id');

//remove the row with the index of 1, reindexes all the rows
$collection->cut(1);

//returns the number of rows
$collection->count();

//adds a new row
$collection->add(array('post_title' => 'Hi'));

//returns a table array (no objects)
$collection->get();

```

====

\#Contributing to Eden

Contributions to *Eden* are following the Github work flow. Please read up before contributing.

\##Setting up your machine with the Eden repository and your fork

1. Fork the repository
2. Fire up your local terminal create a new branch from the `v4` branch of your fork with a branch name describing what your changes are. Possible branch name types:
    - bugfix
    - feature
    - improvement
3. Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")

\##Making pull requests

1. Please ensure to run `phpunit` before making a pull request.
2. Push your code to your remote forked version.
3. Go back to your forked version on GitHub and submit a pull request.
4. An Eden developer will review your code and merge it in when it has been classified as suitable.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~195 days

Total

5

Last Release

3883d ago

Major Versions

1.0.3 → 4.0.02015-10-08

PHP version history (2 changes)1.0.2PHP &gt;=5.3.1

4.0.1PHP &gt;=5.4.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/120378?v=4)[Christian Blanquera](/maintainers/cblanquera)[@cblanquera](https://github.com/cblanquera)

---

Top Contributors

[![clark21](https://avatars.githubusercontent.com/u/5639521?v=4)](https://github.com/clark21 "clark21 (3 commits)")[![Sherlonv](https://avatars.githubusercontent.com/u/5492326?v=4)](https://github.com/Sherlonv "Sherlonv (1 commits)")

---

Tags

libraryeden

### Embed Badge

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

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

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69938.4M138](/packages/league-iso3166)[eden/mail

Eden POP3, IMAP and SMTP component

179276.6k1](/packages/eden-mail)[eden/core

Eden Core component full of secret sauce

15420.8k34](/packages/eden-core)[eden/sqlite

Eden SQLite Search, Collection, Model ORM componen

199.2k2](/packages/eden-sqlite)

PHPackages © 2026

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