PHPackages                             lunkkun/caching-generator - 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. [Caching](/categories/caching)
4. /
5. lunkkun/caching-generator

ActiveLibrary[Caching](/categories/caching)

lunkkun/caching-generator
=========================

A rewindable PHP Generator class that caches its generated values.

v3.1.0(4y ago)417.7k—8%2[1 issues](https://github.com/lunkkun/php-caching-generator/issues)MITPHPPHP &gt;=7.2

Since Oct 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lunkkun/php-caching-generator)[ Packagist](https://packagist.org/packages/lunkkun/caching-generator)[ Docs](https://github.com/lunkkun/php-caching-generator)[ RSS](/packages/lunkkun-caching-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Caching Generator for PHP
=========================

[](#caching-generator-for-php)

Introduction
------------

[](#introduction)

A PHP Iterator class that you can wrap around a generator to cache its generated values. When iterating over this class for a second time, values will be pulled from the cache.

If stopped halfway through generating, when iterating for a second time, it will continue generating (and caching) values after exhausting the cache.

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

[](#installation)

Require this package with composer using the following command:

```
composer require lunkkun/caching-generator
```

Usage
-----

[](#usage)

```
