PHPackages                             lctrs/circular-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. [Queues &amp; Workers](/categories/queues)
4. /
5. lctrs/circular-buffer

ActiveLibrary[Queues &amp; Workers](/categories/queues)

lctrs/circular-buffer
=====================

Provides a circular buffer implementation.

0.1.0(4y ago)2742[1 issues](https://github.com/Lctrs/circular-buffer/issues)[10 PRs](https://github.com/Lctrs/circular-buffer/pulls)MITPHPPHP ^7.3.0 || &gt;=8.0.0 &lt;8.2.0CI passing

Since Oct 16Pushed 1w ago1 watchersCompare

[ Source](https://github.com/Lctrs/circular-buffer)[ Packagist](https://packagist.org/packages/lctrs/circular-buffer)[ Docs](https://github.com/Lctrs/circular-buffer)[ RSS](/packages/lctrs-circular-buffer/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (12)Versions (12)Used By (0)

Circular Buffer
===============

[](#circular-buffer)

[![Integrate](https://github.com/Lctrs/circular-buffer/workflows/Integrate/badge.svg)](https://github.com/Lctrs/circular-buffer/actions)[![Release](https://github.com/Lctrs/circular-buffer/workflows/Release/badge.svg)](https://github.com/Lctrs/circular-buffer/actions)[![Renew](https://github.com/Lctrs/circular-buffer/workflows/Renew/badge.svg)](https://github.com/Lctrs/circular-buffer/actions)

[![Mutation Score](https://camo.githubusercontent.com/803c6cca154ebd4e607548e4b8fab9a5eb7c006d58c40375fdcf0a11809f2273/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532464c6374727325324663697263756c61722d6275666665722532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/Lctrs/circular-buffer/master)[![Code Coverage](https://camo.githubusercontent.com/90bb550fae7674cd1262d82b8b88bfcc64c368003e267af87ba83cfe75d5a972/68747470733a2f2f636f6465636f762e696f2f67682f4c637472732f63697263756c61722d6275666665722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Lctrs/circular-buffer)[![Type Coverage](https://camo.githubusercontent.com/e2853a2937099f2fc26dba9516ae7c0e06f26ac6de23106514adb9682afab4b4/68747470733a2f2f73686570686572642e6465762f6769746875622f4c637472732f63697263756c61722d6275666665722f636f7665726167652e737667)](https://shepherd.dev/github/Lctrs/circular-buffer)

[![Latest Stable Version](https://camo.githubusercontent.com/b42957d1e96b36961ce0e277491d761b1c84f7df0ae5a5599bc1bfe17bda6f96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4c637472732f63697263756c61722d6275666665723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Lctrs/circular-buffer)[![Total Downloads](https://camo.githubusercontent.com/daba956a9e25a72de0cd34c0ed4f64100bceff2ca0f086a5cb8b002442e7fb5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4c637472732f63697263756c61722d6275666665723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Lctrs/circular-buffer)

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

[](#installation)

💡 This is a great place for showing how to install the package, see below:

Run

```
$ composer require lctrs/circular-buffer
```

Usage
-----

[](#usage)

Creating an empty circular buffer of size eg. 2:

```
use Lctrs\CircularBuffer\CircularBuffer;

$buffer = CircularBuffer::ofCapacity(2);
$buffer->write('foo');
$buffer->read(); // foo
```

You can also create a prefilled buffer:

```
use Lctrs\CircularBuffer\CircularBuffer;

$buffer = CircularBuffer::prefilled(2, ['foo', 'bar']);
```

Changelog
---------

[](#changelog)

Please have a look at [`CHANGELOG.md`](CHANGELOG.md).

Contributing
------------

[](#contributing)

Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).

License
-------

[](#license)

This package is licensed using the MIT License.

Please have a look at [`LICENSE.md`](LICENSE.md).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance54

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

1721d ago

### Community

Maintainers

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

---

Top Contributors

[![lctrs-bot](https://avatars.githubusercontent.com/u/62859014?v=4)](https://github.com/lctrs-bot "lctrs-bot (200 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (152 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (52 commits)")[![Lctrs](https://avatars.githubusercontent.com/u/5477973?v=4)](https://github.com/Lctrs "Lctrs (7 commits)")

---

Tags

buffercircularcyclicphpqueueringqueueBufferringcircularcyclic

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[php-amqplib/php-amqplib

Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.

4.6k132.3M1.0k](/packages/php-amqplib-php-amqplib)[ramsey/collection

A PHP library for representing and manipulating collections.

1.2k528.4M95](/packages/ramsey-collection)[queue-interop/queue-interop

Promoting the interoperability of MQs objects. Based on Java JMS

48131.8M96](/packages/queue-interop-queue-interop)[enqueue/enqueue

Message Queue Library

19820.7M63](/packages/enqueue-enqueue)[enqueue/amqp-tools

Message Queue Amqp Tools

14721.9M12](/packages/enqueue-amqp-tools)[phootwork/collection

The phootwork library fills gaps in the php language and provides better solutions than the existing ones php offers.

3928.2M15](/packages/phootwork-collection)

PHPackages © 2026

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