2017 © Pedro Peláez
 

library reallysimplecollection

A simple collection library for PHP.

image

rbdwllr/reallysimplecollection

A simple collection library for PHP.

  • Thursday, May 10, 2018
  • by RobDWaller
  • Repository
  • 1 Watchers
  • 0 Stars
  • 211 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Really Simple Collection

Build Status codecov StyleCI, (*1)

A very simple PHP collection library that helps you turn arrays into collections. Provides lots of useful methods such as first, map, filter, etc., (*2)

Usage

To use the collection just pass an array into the new instance of the collection class., (*3)


use ReallySimple\Collection; $items = ['item1', 'item2', 'item3']; $collection = new Collection($items); echo $collection->count(); // Will Output 3.

You can also create the collection statically., (*4)


use ReallySimple\Collection; $items = ['item1', 'item2', 'item3']; $collection = Collection::make($items); echo $collection->count(); // Will Output 3.

Methods Available

The following methods are currently available for this collection library., (*5)

// Return the number of items in the collection
$collection->count(): int;

// Return the current item the collection pointer is on
$collection->current();

// Filter the collection based on the values and return a new collection
$collection->filter(callable $callback): Collection;

// Filter the collection based on the keys and return a new collection
$collection->filterKeys(callable $callback): Collection;

// Filter the collection based on the keys and values and return a new collection
$collection->filterKeysValues(callable $callback): Collection;

// Return the first item from the collection
$collection->first();

// Return the current key the collection pointer is on
$collection->key();

// Map the collection and return a new collection
$collection->map(callable $callback): Collection;

// Move the collection point forward by one and return value
$collection->next();

// Return the collection pointer to the start of the collection
$collection->rewind();

// Reduce the collection and return a new collection
$collection->reduce(callable $callback, $initial = null): Collection;

// Return the collection as an array
$collection->toArray(): array;

// Check the collection key is valid
$collection->valid(): bool;

Author

The Versions

10/05 2018

dev-master

9999999-dev

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

10/05 2018

0.1.0

0.1.0.0

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

10/05 2018

dev-release-tidy-up

dev-release-tidy-up

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

03/05 2018

dev-reduce-method

dev-reduce-method

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

24/03 2018

0.1-alpha.2

0.1.0.0-alpha2

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

24/03 2018

dev-mess-detection

dev-mess-detection

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

24/03 2018

dev-amends

dev-amends

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

11/03 2018

0.1-alpha.1

0.1.0.0-alpha1

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Rob Waller

php collection array pipeline

07/05 2017

0.1-alpha

0.1.0.0-alpha

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Rob Waller

php collection array pipeline

07/05 2017

dev-analysis-XVYWmB

dev-analysis-XVYWmB

A simple collection library for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Rob Waller

php collection array pipeline