2017 © Pedro Peláez
 

library collection-iterator

Helps iterating big sets of data

image

gacek85/collection-iterator

Helps iterating big sets of data

  • Thursday, September 29, 2016
  • by gacek85
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

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., (*2)

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., (*3)

Public API

CollectionIterator

``` php 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, (*4)


Other public methods are `Iterator` specific API. ###IterableDataProvider ``` php 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 <?php, (*5)

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

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

The Versions

29/09 2016

dev-master

9999999-dev

Helps iterating big sets of data

  Sources   Download

The Requires

 

The Development Requires

by Maciej Garycki

29/09 2016

dev-develop

dev-develop

Helps iterating big sets of data

  Sources   Download

The Requires

 

The Development Requires

by Maciej Garycki

29/09 2016

1.0.1

1.0.1.0

Helps iterating big sets of data

  Sources   Download

The Requires

 

The Development Requires

by Maciej Garycki