easyframework / collections
Collections Abstraction library for PHP
Installs: 238 238
Dependents: 19
Suggesters: 0
Security: 0
Stars: 62
Watchers: 8
Forks: 17
Open Issues: 1
Requires
- php: >=5.6.0
- easyframework/generics: ~2.0
Requires (Dev)
- codacy/coverage: dev-master
- phpunit/phpunit: ~5.0
- dev-master / 6.0.x-dev
- v7.0.0
- v6.0.1
- v6.0.0
- 5.x-dev
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- 5.0.0-beta
- v4.1.8
- v4.1.7
- v4.1.6
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.0
- v4.0.0-beta
- 3.2.x-dev
- v3.2.0
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.0
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.0
This package is not auto-updated.
Last update: 2020-01-24 15:01:54 UTC
README
Collections Abstraction library for PHP
The Collection library is one of the most useful things that many modern languages has, but for some reason PHP doesn't has a built in collection layer.
For that reason we created Collections, an incredible library that gathers the best of .NET's and Java's collections patterns and unify it with PHP array power.
Take a look and see what we're talking about!!
Install
composer require easyframework/collections
Usage
The Collection Class
The Collection represents the List in .NET language or simply non-associative arrays in php:
$person1 = new \stdClass(); $person1->name = 'John'; $person1->age = 25; $person2 = new \stdClass(); $person2->name = 'Maria'; $person2->age = 30; $person3 = new \stdClass(); $person3->name = 'Anderson'; $person3->age = 15; $collection = new Collections\Vector(); $collection->add($person1); $collection->add($person2); $collection->add($person3); $collection->filter(function($person){ return $person->age > 18; })->each(function($item){ echo $item->name; //John and Maria });
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
Documentation
More information can be found in the online documentation at https://italolelis.gitbooks.io/collections.