nikic/iter — 1.1k★ on GitHub (PHP). Iteration primitives using generators
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
This library implements iteration primitives like map() and filter()
using generators. To a large part this serves as a repository for small
examples of generator usage, but of course the functions are also practically
quite useful.
All functions in this library accept arbitrary iterables, i.e. arrays,
traversables, iterators and aggregates, which makes it quite different from
functions like array_map() (which only accept arrays) and the SPL iterators
(which usually only accept iterators, not even aggregates). The operations are
of course lazy.
Install
To install with composer:
composer require nikic/iter
Functionality
A small usage example for the map() and range() functions:
As the functionality is implemented using generators the resulting iterators
are by default not rewindable. This library implements additional functionality
to allow creating rewindable generators.
You can find documentation for this in iter.rewindable.php,
here is just a small usage example of the two main functions:
<?php
use iter\func;
require 'path/to/vendor/autoload.php';
/* Create a rewindable map function which can be used multiple times */
$rewindableMap = iter\makeRewindable('iter\\map');
$res = $rewindableMap(func\operator('*', 3), [1, 2, 3]);
/* Do a rewindable call to map, just once */
$res = iter\callRewindable('iter\\map', func\operator('*', 3), [1, 2, 3]);
The above functions are only useful for your own iterators though; for the
iter iterators, rewindable variants are directly provided with an
iter\rewindable prefix:
No homepage URL was recorded for nikic/iter in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does nikic/iter have any tags?
TopGit's last sync did not record any GitHub topics for nikic/iter. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on nikic/iter?
The most recent commit recorded on nikic/iter was 1.0 years ago, based on the GitHub push timestamp. The repository has 70 forks — one of the better signals of community interest.
How many stars does nikic/iter have?
nikic/iter has 1.1k GitHub stars — refresh the page for the live number, or check github.com/nikic/iter. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is nikic/iter open source?
TopGit's metadata for nikic/iter does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
Where do I read more about nikic/iter?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/nikic/iter is the definitive source.
Read full README in the tab above.
Want a second opinion on iter?
Ask an AI that can read this page — one click and you get its take on iter.