harbinger/iterator
最新稳定版本:3.0.0
Composer 安装命令:
composer require harbinger/iterator
包简介
Harbinger library for handle object collection as iterator
README 文档
README
Harbinger\Iterator is a library for collection control. It's loosely based on typed lists from strongly typed languages (such Java, C#, etc.).
Requirements
- PHP 7.0+ (Version
2.0.0or earlier) - PHP 5.6+ (Version
1.x.x)
Installation
Package avaible at Packgist
composer.json
#!json
{
"require": {
"harbinger/iterator": "@stable",
}
}
Usage
As a simple object typed list (eg.: Connection list)
#!php
$collection = new \Harbinger\Iterator\Collection\Object(\Connection::class);
$collection->add(new \Connection('pgsql'));
$collection->add(new \Connection('mysql'));
foreach($collection AS $connection) {
}
This implementation kind doesn't need any other implementation, but cannot be type hinted for a specified collection list.
Must be validate with \Harbinger\Iterator\Collection::getTargetClass().
#!php
$collection->getTargetClass() === \Connection::class;
As a modeled object typed list (eg.: Connection list)
#!php
namespace Collection;
class Connection extends \Harbinger\Iterator\Collection {
/**
* {@inheritdoc}
**/
public function getTargetClass() {
return \Contato::class;
}
}
#!php
$collection = new \Collection\Connection();
$collection->add(new \Connection('pgsql'));
$collection->add(new \Connection('mysql'));
foreach($collection AS $connection) {
}
Must be implemented for the specified object. Can use type hint:
#!php
public function setCollection(\Collection\Connection $collection) {
}
Changelog
3.0.0
- Added method
lastto seek and retrieve the last element from collection
3.0.0-RC
- Removed
\Harbinger\Iterator\Filter\Custom. It's better use the CallbackFilterIterator from SPL
2.0.0
- Implementation for PHP 7 support;
- Add new test for
\Harbinger\Iterator\Filter\Custom.
1.0.7
- Added method
lastto seek and retrieve the last element from collection
1.0.6
- Add new test for
\Harbinger\Iterator\Filter\Custom.
1.0.5
- Updated style coding to match with PSR-1 and PSR-2 (except spaces before comma: interfaces and functions args);
- Removed phpDocumentor version tag.
1.0.4
- Construct from
\Harbinger\Iterator\Collection\Objectthrow an UnexceptedValueException when a non string or empty string is given as parameter; - Refactored some phpdoc version blocks.
1.0.3
- License information corrected.
1.0.2
- License information corrected;
- Corrected
composer.json.
1.0.1
- Corrected
composer.json; - Refactored some phpdoc blocks.
1.0.0
- Project started.
harbinger/iterator 适用场景与选型建议
harbinger/iterator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 93 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 06 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「iterator」 「filter」 「object」 「collection」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 harbinger/iterator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 harbinger/iterator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 harbinger/iterator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
collection php library
Runn Me! Value Objects Library
Nova searchable filter for belongsTo relationships.
PHP PDO Mysql select statement iterator implemented as multiple queries using LIMIT clauses
Iteration tools for PHP
统计信息
- 总下载量: 93
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-06-29