PHPackages                             devlop/buffer - 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. devlop/buffer

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

devlop/buffer
=============

Simple Buffer for iterating over an iteratable and regularly applying a callback.

1.2.0(5y ago)093[1 issues](https://github.com/devlop/buffer/issues)MITPHPPHP ^7.4|^8.0

Since Dec 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/devlop/buffer)[ Packagist](https://packagist.org/packages/devlop/buffer)[ RSS](/packages/devlop-buffer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

 [![Latest Stable Version](https://camo.githubusercontent.com/79aa2a66d466644bbfa0f3d9dc7804c63e49d1cf87d5ffcad66dadbc75b0fa14/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465766c6f702f627566666572)](https://packagist.org/packages/devlop/buffer) [![License](https://camo.githubusercontent.com/211f825e77119b4ab2697ff5cc74a4b0244b7af5e20cd3956b62d7a33a53ef86/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465766c6f702f627566666572)](https://github.com/devlop/buffer/blob/master/LICENSE.md)

Buffer
======

[](#buffer)

Simple Buffer for iterating over an iteratable and regularly applying a callback.

This allows you to consume a large array with minimal memory usage.

Installation
============

[](#installation)

```
composer require devlop/buffer
```

Usage
=====

[](#usage)

Manual
------

[](#manual)

This way gives you the most power, but also forces you to take more responsibility over execution.

```
use Devlop\Buffer\Buffer;

$bigFuckingArray = [...]; // array containing between zero and many many items

$buffer = new Buffer(
    10, // max Buffer size
    function (array $items) : void {
        // callback to apply when buffer size reaches max
    },
);

foreach ($bigFuckingArray as $key => $value) {
    $buffer->push($value); // the Buffer callback will automatically be applied when needed
}

// important, after looping over the array, remember to manually call the flush() method to apply the callback on last time if needed
$buffer->flush();
```

Automatic
---------

[](#automatic)

This way is the easiest way to use the Buffer and requires least work from you.

```
use Devlop\Buffer\Buffer;

$bigFuckingArray = [...]; // array containing between zero and many many items

Buffer::iterate(
    $bigFuckingArray, // input iterable
    10, // max Buffer size
    function (array $items) : void {
        // callback to apply when buffer size reaches max
        // the callback will also be called one last time after finishing iterating if needed
    },
)
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

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

Every ~27 days

Total

5

Last Release

1865d ago

Major Versions

0.1.0 → 1.0.02021-02-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/caa865d4467587eecd242fadf805f15ce436c9d7efa7786b49b69a193c158aaf?d=identicon)[johanrosenson](/maintainers/johanrosenson)

---

Top Contributors

[![johanrosenson](https://avatars.githubusercontent.com/u/10432296?v=4)](https://github.com/johanrosenson "johanrosenson (13 commits)")

---

Tags

php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/devlop-buffer/health.svg)

```
[![Health](https://phpackages.com/badges/devlop-buffer/health.svg)](https://phpackages.com/packages/devlop-buffer)
```

###  Alternatives

[steffenbrand/dmn-decision-tables

PHP library to programmatically create DMN decision tables.

1916.7k](/packages/steffenbrand-dmn-decision-tables)

PHPackages © 2026

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