PHPackages                             dhii/iterator-interface - 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. dhii/iterator-interface

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

dhii/iterator-interface
=======================

Interfaces for standard iterators

v0.1-alpha1(8y ago)08.7k3MITPHPPHP ^5.3 | ^7.0

Since Jul 23Pushed 8y ago3 watchersCompare

[ Source](https://github.com/Dhii/iterator-interface)[ Packagist](https://packagist.org/packages/dhii/iterator-interface)[ RSS](/packages/dhii-iterator-interface/feed)WikiDiscussions develop Synced 3d ago

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

Dhii - Iterator - Interface
===========================

[](#dhii---iterator---interface)

[![Build Status](https://camo.githubusercontent.com/f5f0712dd638a2a452539b877b5ae3c71adda03ea09e3378b8440feec9c8557f/68747470733a2f2f7472617669732d63692e6f72672f446869692f6974657261746f722d696e746572666163652e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/dhii/iterator-interface)[![Code Climate](https://camo.githubusercontent.com/1338e488c9070749990a1e3d4f98fabccfe26489fd1f3a878e3e62c81df38f4d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f446869692f6974657261746f722d696e746572666163652f6261646765732f6770612e737667)](https://codeclimate.com/github/Dhii/iterator-interface)[![Test Coverage](https://camo.githubusercontent.com/4bcd3651301626564184ecc7b0a1e4cf662c93fe87aa3e796756bd5e45b8446f/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f446869692f6974657261746f722d696e746572666163652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/Dhii/iterator-interface/coverage)[![Latest Stable Version](https://camo.githubusercontent.com/5a43f752bdef447491c2d459dff4cb1b7c42442a4bf98c733a5747b3d6759ef9/68747470733a2f2f706f7365722e707567782e6f72672f646869692f6974657261746f722d696e746572666163652f76657273696f6e)](https://packagist.org/packages/dhii/iterator-interface)[![This package complies with Dhii standards](https://camo.githubusercontent.com/44bbe8c7678c1784cfc53cabce5d3e32fc22a840453c5ed9c08601522fe7c213/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446869692d436f6d706c69616e742d677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Dhii/dhii)

Details
-------

[](#details)

An iterator standard, which aims to provide more information about each iteration by exposing an immutable iteration object. This object can be safely passed to other methods, even those which save the reference to it, as a new object is created for every iteration. That object can provide additional information besides the current key and value. This makes implementations of this standard easier to work with than other iterator implementations, such as [`DirectoryIterator`](http://php.net/manual/en/class.directoryiterator.php), which expose iteration data through the iterator itself, instead of a separate object, making it hard to keep iteration data immutable. The fact that its manipulator methods are allowed to throw a specific type of exception make it possible to create more reliable consumers with meaningful error reporting.

### Features

[](#features)

- All standards-compliant iterators are PHP iterators.
- Iteration information provided via immutable and extensible iteration objects.
- Easier to keep track of iteration information: each iteration produces a separate iteration object.
- Specialized iterator types can be created on interface level by promising custom iteration types.

### Interfaces

[](#interfaces)

- [`IteratorInterface`](src/IteratorInterface.php) - Extends the native [`Iterator`](http://php.net/manual/en/class.iterator.php) by exposing a disposable iteration object. Also promises to throw a specific kind of meaningful exception when rewinding or advancing.
- [`IterationInterface`](src/IterationInterface.php) - Exposes the key and the value of an iteration.
- [`IteratorAwareInterface`](src/IteratorAwareInterface.php) - Exposes an iterator.
- [`RecursiveIteratorInterface`](src/RecursiveIteratorInterface.php) - An iterator that iterates over other iterators recursively.
- [`RecursiveIterationInterface`](src/RecursiveIterationInterface.php) - An iteration of a recursive iterator. Exposes the depth of the iterator hierarchy, and the path to the current iteration in that hierarchy.
- [`DepthAwareIterationInterface`](src/DepthAwareIterationInterface.php) - An iteration that can tell how deep it is in a hierarchy.
- [`PathSegmentsAwareIterationInterface`](src/PathSegmentsAwareIterationInterface.php) - An iteration that can tell the path to itself in a hierarchy.
- [`IteratingExceptionInterface`](src/Exception/IteratingExceptionInterface.php) - An exception that can occur during iteration.
- [`IterationExceptionInterface`](src/Exception/IterationExceptionInterface.php) - An iterating exception that relates to an iteration.
- [`IteratorExceptionInterface`](src/Exception/IteratorExceptionInterface.php) - An iteration exception that relates to an iterator.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.3% 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

2942d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1894e91b32c9f80d8f30a42d360af6983a507f1cf2c621b7c9a0a0de14e011c5?d=identicon)[XedinUnknown](/maintainers/XedinUnknown)

---

Top Contributors

[![XedinUnknown](https://avatars.githubusercontent.com/u/1428973?v=4)](https://github.com/XedinUnknown "XedinUnknown (24 commits)")[![mecha](https://avatars.githubusercontent.com/u/5425482?v=4)](https://github.com/mecha "mecha (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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