定制 solution10/collection 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

solution10/collection

最新稳定版本:v1.3.1

Composer 安装命令:

composer require solution10/collection

包简介

A simple and fast Collection class

README 文档

README

Like Arrays. Only better!

Build Status Coverage Status

Latest Stable Version Total Downloads Latest Unstable Version License

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

MIT

Contributing

Contributors Notes

统计信息

  • 总下载量: 523
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-17