Skip to content

[READ-ONLY] Collection library in CakePHP. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

License

Notifications You must be signed in to change notification settings

cakephp/collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6bf6800 · May 24, 2021
May 24, 2021
May 7, 2019
Mar 4, 2021
Apr 9, 2021
Dec 2, 2020
Oct 12, 2019
Oct 31, 2019
May 10, 2019
May 7, 2019

Repository files navigation

Total Downloads License

CakePHP Collection Library

The collection classes provide a set of tools to manipulate arrays or Traversable objects. If you have ever used underscore.js, you have an idea of what you can expect from the collection classes.

Usage

Collections can be created using an array or Traversable object. A simple use of a Collection would be:

use Cake\Collection\Collection;

$items = ['a' => 1, 'b' => 2, 'c' => 3];
$collection = new Collection($items);

// Create a new collection containing elements
// with a value greater than one.
$overOne = $collection->filter(function ($value, $key, $iterator) {
    return $value > 1;
});

The Collection\CollectionTrait allows you to integrate collection-like features into any Traversable object you have in your application as well.

Documentation

Please make sure you check the official documentation

About

[READ-ONLY] Collection library in CakePHP. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages