{"id":20842837,"url":"https://github.com/mudge/iterator","last_synced_at":"2025-08-16T17:04:33.449Z","repository":{"id":66366870,"uuid":"21891702","full_name":"mudge/iterator","owner":"mudge","description":"An assortment of Iterators for PHP.","archived":false,"fork":false,"pushed_at":"2014-07-16T09:43:32.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-11T04:39:15.902Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mudge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-16T07:49:15.000Z","updated_at":"2014-07-16T07:54:55.000Z","dependencies_parsed_at":"2023-02-20T03:00:23.294Z","dependency_job_id":null,"html_url":"https://github.com/mudge/iterator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mudge/iterator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fiterator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fiterator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fiterator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fiterator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mudge","download_url":"https://codeload.github.com/mudge/iterator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fiterator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270742043,"owners_count":24637504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T01:25:41.101Z","updated_at":"2025-08-16T17:04:33.093Z","avatar_url":"https://github.com/mudge.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Iterator [![Build Status](https://travis-ci.org/mudge/iterator.svg?branch=master)](https://travis-ci.org/mudge/iterator)\n\nAn assortment of [Iterators](http://www.php.net/manual/en/class.iterator.php)\nfor PHP based on [Guzzle Iterator](https://github.com/guzzle/iterator).\n\n## FlatMapIterator\n\n```haskell\nFlatMapIterator :: Traversable a -\u003e (a -\u003e RecursiveIterator b) -\u003e RecursiveIterator b\n```\n\nMaps over values in a\n[`Traversable`](http://php.net/manual/en/class.traversable.php), applying a\nfunction that returns a\n[`RecursiveIterator`](http://uk3.php.net/manual/en/class.recursiveiterator.php)\n(e.g. a\n[`RecursiveArrayIterator`](http://uk3.php.net/manual/en/class.recursivearrayiterator.php))\nand returns a new `RecursiveIterator` of the new values.\n\nThis can then be used with a\n[`RecursiveIteratorIterator`](http://uk3.php.net/manual/en/class.recursiveiteratoriterator.php)\nto flatten all values like so:\n\n```php\n$iterator = new FlatMapIterator(new \\ArrayIterator(array(1, 2)), function ($x) {\n    return new \\RecursiveArrayIterator(array($x, $x * 2));\n});\n\n$recursiveIterator = new \\RecursiveIteratorIterator($iterator);\n$values = iterator_to_array($recursiveIterator, false));\n// =\u003e array(1, 2, 2, 4);\n```\n\n## References\n\n* [Guzzle Iterator](https://github.com/guzzle/iterator);\n* [Hoa Iterator](https://github.com/hoaproject/Iterator);\n* [How does RecursiveIteratorIterator work in\n  PHP?](http://stackoverflow.com/questions/12077177/how-does-recursiveiteratoriterator-work-in-php);\n\n## License\n\nCopyright © 2014 Paul Mucur.\n\nDistributed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudge%2Fiterator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmudge%2Fiterator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudge%2Fiterator/lists"}