2017 © Pedro Peláez
 

library collection

Array collection for PHP

image

thanhtaivtt/collection

Array collection for PHP

  • Sunday, March 18, 2018
  • by thanhtaivtt
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 30 % Grown

The README.md

Array Collection for PHP

Install

composer require thanhtaivtt/collection

Usage

use thanhtaivtt\Collection\Collection;

//init
$collection = new Collection([1,2,3,4,5,6]);

//or
Collection::init([1,2,3,6,4]);

Suport Methods

sum

  • The sum method returns the sum of all items in the collection:
    Collection::init([1, 2, 3])->sum();
    // 6

sum

  • The avg method returns the average of all items in the collection:
    Collection::init([1, 2, 3])->avg();
    // 2

min

  • The min method returns the min of all items in the collection:
    Collection::init([1, 2, 3])->min();
    // 1

max

  • The max method returns the max of all items in the collection:
    Collection::init([1, 2, 3])->max();
    // 1

all

  • The all method returns the all items in the collection:
    Collection::init([1, 2, 3])->all();
    // [1,2,3]

chunk

  • The chunk method breaks the collection into multiple, smaller collections of a given length:
    $chunk = Collection::init([1, 2, 3])->chunk(2);
    $chunk->toArray();
    // [[1, 2], [3]]

toArray

  • The toArray method converts all items in Object to Array:
    $chunk = Collection::init([1, 2, 3])->toArray();
    // [1, 2, 3]

...., (*1)

The Versions

18/03 2018

dev-master

9999999-dev http://toidicode.com

Array collection for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

18/03 2018

dev-dev

dev-dev http://toidicode.com

Array collection for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

18/03 2018

1.0.0

1.0.0.0 http://toidicode.com

Array collection for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires