lctrs/circular-buffer

Provides a circular buffer implementation.

0.1.0 2021-10-16 13:56 UTC

README

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.