easyframework / collections
此包已被弃用且不再维护。未建议替代包。
PHP的集合抽象库
v7.0.0
2016-12-13 14:14 UTC
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
PHP的集合抽象库
集合库是许多现代语言中最有用的事物之一,但不知何故,PHP没有内置的集合层。
因此我们创建了Collections,这是一个集成了.NET和Java集合模式的精华,并与PHP数组功能统一的卓越库。
看看我们到底在说什么吧!!
安装
composer require easyframework/collections
使用
集合类
集合代表.NET语言中的List或简而言之是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以获取详细信息。
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。
文档
更多信息可以在https://italolelis.gitbooks.io/collections上的在线文档中找到。