Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PHP
  3. Iter

Iter

NOASSERTIONPHPv2.4.1

A PHP library providing iteration primitives like map and filter using generators, working with any iterable type.

GitHubGitHub
1.1k stars69 forks0 contributors

What is Iter?

Iter is a PHP library that provides iteration primitives like map, filter, and reduce using generators. It solves the problem of performing functional operations on any iterable type—not just arrays—while maintaining lazy evaluation for memory efficiency.

Target Audience

PHP developers working with iterators, generators, or functional programming patterns who need consistent iteration utilities across different iterable data structures.

Value Proposition

Developers choose Iter because it offers a unified, lazy approach to iteration that works with arrays, traversables, and custom iterators, unlike native PHP array functions or SPL iterators which are more limited in scope.

Overview

Iteration primitives using generators

Use Cases

Best For

  • Applying functional operations to PHP generators or iterators
  • Working lazily with large datasets to reduce memory usage
  • Creating reusable iteration pipelines across different iterable types
  • Implementing functional programming patterns in PHP codebases
  • Extending iteration capabilities beyond standard array functions
  • Building rewindable generator-based iterators for multiple passes

Not Ideal For

  • Projects exclusively using arrays that don't benefit from lazy iteration
  • Applications requiring eager evaluation for immediate full result sets
  • Teams needing a fully-featured functional programming library with monads or currying
  • Scenarios where performance overhead from generator abstraction is unacceptable

Pros & Cons

Pros

Universal Iterable Support

Functions work with arrays, traversables, iterators, and aggregates, unlike native array_map or SPL iterators that are limited, enabling consistent code across data structures.

Lazy Evaluation Efficiency

Operations use PHP generators to process data on-demand, reducing memory usage for large datasets compared to eager array functions that create intermediate arrays.

Comprehensive Function Set

Includes map, filter, reduce, zip, chain, and over 30 other primitives, providing a wide range of functional iteration tools directly in the library.

Rewindable Generator Utilities

Offers makeRewindable and rewindable prefixes to handle multiple passes over generator-based iterators, addressing a common limitation of default generators.

Cons

Non-Rewindable By Default

Generators are inherently non-rewindable, requiring extra steps like rewindable wrappers for reuse, which adds complexity compared to native arrays or SPL iterators.

Sparse Documentation

Usage examples are minimal in the README; developers must read the source file iter.php for details, making onboarding harder than with fully documented libraries.

Limited Functional Extensions

Focuses solely on iteration primitives without advanced functional features like partial application or monadic operations, which might require additional libraries.

Frequently Asked Questions

Quick Stats

Stars1,145
Forks69
Contributors0
Open Issues9
Last commit8 months ago
CreatedSince 2013

Tags

#functional-programming#iterator#php#generators#iteration#lazy-evaluation

Built With

C
Composer
P
PHP

Included in

PHP32.5k
Auto-fetched 6 hours ago

Related Projects

Design Patterns PHPDesign Patterns PHP

Sample code for several design patterns in PHP 8.x

Stars22,193
Forks4,528
Last commit1 year ago
Functional PHPFunctional PHP

Primitives for functional programming in PHP

Stars1,988
Forks207
Last commit1 month ago
FiniteFinite

A Simple PHP Finite State Machine

Stars1,348
Forks185
Last commit5 months ago
PipelinePipeline

League\Pipeline

Stars1,001
Forks74
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub