Skip to content

A circular buffer implementation in PHP

License

Notifications You must be signed in to change notification settings

Lctrs/circular-buffer

Repository files navigation

Circular Buffer

Integrate Release Renew

Mutation Score Code Coverage Type Coverage

Latest Stable Version Total Downloads

Installation

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

Run

$ composer require lctrs/circular-buffer

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

Please have a look at CHANGELOG.md.

Contributing

Please have a look at CONTRIBUTING.md.

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.