gacek85/collection-iterator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

gacek85/collection-iterator

Composer 安装命令:

composer require gacek85/collection-iterator

包简介

Helps iterating big sets of data

README 文档

README

Build Status

#Collection Iterator

An implementation of SPL's Iterator for traversing large collections of data minimising the risk of memory limit exhaustion. Consists of an iterator service class Gacek85\Collection\CollectionIterator and an interface Gacek85\Collection\IterableDataProvider for a provider that will be providing chunks of data to the iterator service.

##How it works

The iterator loads the data using the provider chunk by chunk, previously loaded data are wiped out of the memory by the garbage collector.

##Public API

###CollectionIterator

setPerPage(int $perPage): CollectionIterator // Sets the number of items loaded at once
count(): int	// Returns the total count of the elements that will be traversed

Other public methods are Iterator specific API.

###IterableDataProvider

getTotal(): int // Returns the total count of available elements
getChunk(int $offset, int $limit): array|Iterator //Returns the chunk of data from given offset limited with given limit

##Usage

<?php

$provider = new \My\Provider(); // An implementation of Gacek85\Collection\IterableDataProvider
$iterator = new \Gacek85\Collection\CollectionIterator($provider);

foreach ($iterator as $k => $item) {
	// Do your stuff here with the item
}

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-09-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固