2017 © Pedro Peláez
 

library collection

Collection library for PHP

image

webcodr/collection

Collection library for PHP

  • Friday, December 20, 2013
  • by MadCatme
  • Repository
  • 1 Watchers
  • 7 Stars
  • 156 Installations
  • JavaScript
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Collection

Build Status, (*1)

PHP version, (*2)

A set of array replacement classes for PHP

Requirements

  • PHP 5.4
  • Composer

Setup

Add Collection to your project

~~~ bash $ php composer.phar require webcodr/collection:2.*, (*3)


### Basic information Collections provides two classes: MutableMap and ArrayMap ArrayMap extends MutableMap with an implementation of the SPL interface ArrayAccess MutableMap implements the SPL interfaces IteratorAggregate and Countable. Both classes support a fluent interface with method chaining. Methods without a specific return value like `get()` or `has()` will return in the object itself. ### Usage A little code example says more than 1,000 words, so here we go: The complete documentation is available in doc directory. (it's little buggy due to the use of traits) ~~~ php <?php use Collection\MutableMap; $map = new MutableMap([ 'name' => 'William Adama', 'rank' => 'Admiral' ]); // getter and setter methods echo $map->get('name'); // result = William Adama var_dump($map->has('name')); // result = true $map->set('commands', 'BSG 75'); // iterator method (you also use foreach() on the $map object) $map->each(function($value, $attribute) { echo "{$attribute}: {$value}"; }); // update attributes with an array $map->update([ 'name' => 'Lee Adama', 'rank' => 'Commander', 'commands' => 'BSG 62' ]); echo $map->get('name'); // result = Lee Adama // fast access with first() and last() $battlestars = new MutableMap('Galactica', 'Pegasus', 'Atlantia'); echo $battlestars->first(); // result = Galactica echo $battlestars->last(); // result = Atlantia // method chaining echo $battlestars->reverse()->last(); // result = Galactica

The Versions

20/12 2013

dev-master

9999999-dev https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

09/06 2013

2.1.4

2.1.4.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

08/06 2013

2.1.3

2.1.3.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

14/04 2013

2.1.2

2.1.2.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

14/04 2013

2.1.1

2.1.1.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

05/04 2013

2.1.0

2.1.0.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

01/04 2013

2.0.1

2.0.1.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

01/04 2013

2.0.0

2.0.0.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

collection array

20/03 2013

1.x-dev

1.9999999.9999999.9999999-dev https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

collection array

20/03 2013

1.1.0

1.1.0.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

collection array

03/03 2013

1.0.0

1.0.0.0 https://github.com/WebCodr/Collection

Collection library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

collection array