A robust and optimized library for advanced PHP Iterators.
Enhance your PHP applications with high-performance iterators: lookahead, peeking, filtering, grouping, chunking, and more.
- 🔁 Advanced and composable iterator types
- 👀 Lookahead and peeking support
- 🧼 Filtering and mapping
- 🧩 Grouping, chunking, and flattening
- 🧪 Fully tested, mutation safe, and statically analyzed
Install via Composer:
composer require fast-forward/iteratorsRequirements: PHP 8.3 or higher
use FastForward\Iterator\ChunkedIteratorAggregate;
$data = range(1, 10);
$chunked = new ChunkedIteratorAggregate($data, 3);
foreach ($chunked as $chunk) {
print_r($chunk);
}Expected output:
Array
(
[0] => 1
[1] => 2
[2] => 3
)
Array
(
[0] => 4
[1] => 5
[2] => 6
)
Array
(
[0] => 7
[1] => 8
[2] => 9
)
Array
(
[0] => 10
)
All iterators and utilities are available under the FastForward\Iterator namespace. Simply require Composer's autoloader:
require_once 'vendor/autoload.php';
use FastForward\Iterator\ChunkedIteratorAggregate;
use FastForward\Iterator\SlidingWindowIteratorIterator;
// ...You can chain, compose, and adapt iterators for a wide variety of data processing tasks.
- 📖 Full Documentation
- 🧑💻 Examples Directory
- Each file demonstrates a specific iterator or pattern:
Contributions, bug reports and suggestions are welcome! Please open an issue or pull request on GitHub.
Felipe Sayão Lobato Abreu
github@mentordosnerds.com
This project is licensed under the MIT License.