solution10/collection
最新稳定版本:v1.3.1
Composer 安装命令:
composer require solution10/collection
包简介
A simple and fast Collection class
README 文档
README
Like Arrays. Only better!
What does this do?
Collections, at their core, are implementations of Iterator, ArrayAccess and Countable. But they're also a lot more than that.
Splice subsections of arrays simply by passing keys:
$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
$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.
Installation
Install via composer:
"require": { "solution10/collection": "1.*" }
Requirements
- PHP >= 5.3
That's it!
Documentation
See the Github Wiki or the docs/ folder in the repo.
To get api docs; from a checkout of the project run:
$ make && open api/index.html
License
Contributing
统计信息
- 总下载量: 523
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 2
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-07-17