2017 © Pedro Peláez
 

library collection

A simple and fast Collection class

image

solution10/collection

A simple and fast Collection class

  • Saturday, November 29, 2014
  • by alexgisby
  • Repository
  • 1 Watchers
  • 3 Stars
  • 446 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Solution10\Collection

Like Arrays. Only better!, (*1)

Build Status Coverage Status, (*2)

Latest Stable Version Total Downloads Latest Unstable Version License, (*3)

What does this do?

Collections, at their core, are implementations of Iterator, ArrayAccess and Countable. But they're also a lot more than that., (*4)

Splice subsections of arrays simply by passing keys:, (*5)

$collection = new Collection(array('Apple', 'Orange', 'Banana'));
$subset = $collection['0:1'];
// $subset is now: array('Apple', 'Orange')

$collection = new Collection(array('Apple', 'Orange', 'Banana'));
$subset = $collection['-2:2'];
// $subset contains ('Orange', 'Banana')

$collection = new Collection(array('Apple', 'Orange', 'Banana', 'Grapes'));
$subset = $collection[':LAST'];
// $subset is simply array('Grapes')

Quickly and easily Sort, (*6)

$collection = new Collection(array(100, 50, 70, 10));
$collection->sort(Collection::SORT_ASC);
// $collection's order is now: 10, 50, 70, 100

$collection = new Collection(array(
    array(
        'name' => 'Sarah',
        'job' => 'Manager',
    ),
    array(
        'name' => 'Alex',
        'job' => 'Developer',
    ),
    array(
        'name' => 'Tracy',
        'job' => 'HR'
    ),
));
$collection->sortByMember('name', Collection::SORT_ASC);

For full feature list, check out the docs., (*7)

Installation

Install via composer:, (*8)

"require": {
    "solution10/collection": "1.*"
}

Requirements

  • PHP >= 5.3

That's it!, (*9)

Documentation

See the Github Wiki or the docs/ folder in the repo., (*10)

To get api docs; from a checkout of the project run:, (*11)

$ make && open api/index.html

License

MIT, (*12)

Contributing

Contributors Notes, (*13)

The Versions

29/11 2014

dev-master

9999999-dev

A simple and fast Collection class

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Alex Gisby

collection array iterator sort splice

29/11 2014

v1.3.1

1.3.1.0

A simple and fast Collection class

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Alex Gisby

collection array iterator sort splice

29/10 2014

v1.3.0

1.3.0.0

A simple and fast Collection class

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Alex Gisby

collection array iterator sort splice

25/07 2014

v1.2.0

1.2.0.0

A simple and fast Collection class

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Alex Gisby

collection array iterator sort splice

25/07 2014

dev-unstable

dev-unstable

A simple and fast Collection class

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Alex Gisby

collection array iterator sort splice

24/07 2014

v1.1.0

1.1.0.0

A simple and fast Collection class

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Alex Gisby

collection array iterator sort splice

17/07 2014

v1.0.0

1.0.0.0

A simple and fast Collection class

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Alex Gisby