PHPackages                             componenta/iterator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. componenta/iterator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

componenta/iterator
===================

Iterator helpers and replayable iterators for Componenta packages

v1.0.0(1mo ago)092MITPHPPHP ^8.4

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/componenta/iterator)[ Packagist](https://packagist.org/packages/componenta/iterator)[ RSS](/packages/componenta-iterator/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (2)

Componenta Iterator
===================

[](#componenta-iterator)

Iterator utilities for replayable iteration, reverse traversal, string traversal, and array conversion.

Use this package when a library needs iterator behavior without depending on collection frameworks.

Installation
------------

[](#installation)

```
composer require componenta/iterator
```

Related Packages
----------------

[](#related-packages)

PackageWhy it matters here`componenta/stream-iterator`Prefer it for large PSR-7 streams because it keeps only the current chunk in memory.`componenta/arrayable`Some iterators expose `toArray()` for array conversion.ReplayableIterator
------------------

[](#replayableiterator)

`ReplayableIterator` wraps arrays, iterators, iterator aggregates, and generators. It caches traversed values so a one-shot source can be iterated again.

```
use Componenta\Stdlib\ReplayableIterator;

$iterator = new ReplayableIterator((function () {
    yield 'a' => 1;
    yield 'b' => 2;
})());

$iterator->toArray(preserveKeys: true); // ['a' => 1, 'b' => 2]
```

Calling `count()` or `toArray()` forces full traversal of the wrapped source.

Reverse Iteration
-----------------

[](#reverse-iteration)

`ReverseIterator` iterates an iterable in reverse order. It materializes values internally, so it is intended for finite iterables.

`ArrayListReverseIterator` is a small reverse iterator for list arrays.

StringIterator
--------------

[](#stringiterator)

`StringIterator` iterates over a string with encoding support and cursor helpers:

- `moveTo()`
- `forward()`
- `backward()`
- `read()`
- `remaining()`
- `peek()`

Array Conversion
----------------

[](#array-conversion)

`IteratorToArray` exposes a `toArray()` contract for iterator classes that can materialize their contents.

Memory Notes
------------

[](#memory-notes)

Replayable and reverse iterators trade memory for traversal behavior. They are appropriate for finite sequences. For large PSR-7 streams, use `componenta/stream-iterator`, which keeps only the current chunk.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20490712?v=4)[Andrey Shelamkoff](/maintainers/Shelamkoff)[@Shelamkoff](https://github.com/Shelamkoff)

---

Top Contributors

[![Shelamkoff](https://avatars.githubusercontent.com/u/20490712?v=4)](https://github.com/Shelamkoff "Shelamkoff (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/componenta-iterator/health.svg)

```
[![Health](https://phpackages.com/badges/componenta-iterator/health.svg)](https://phpackages.com/packages/componenta-iterator)
```

###  Alternatives

[hughgrigg/php-business-time

Business time / working days extension for Carbon dates

3330.5k](/packages/hughgrigg-php-business-time)[tu6ge/voyager-excel

voyager excel export hook

215.0k](/packages/tu6ge-voyager-excel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
