PHPackages                             php-snippets/circular-array - 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. php-snippets/circular-array

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

php-snippets/circular-array
===========================

Fixed circular array data structure

v1.0.0(8y ago)1247.5k21MITPHPPHP &gt;=5.3

Since Oct 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/webysther/CircularArray)[ Packagist](https://packagist.org/packages/php-snippets/circular-array)[ RSS](/packages/php-snippets-circular-array/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

Circular Array
==============

[](#circular-array)

[![Build Status](https://camo.githubusercontent.com/0864aeca621f8d92fa141ce4adc3b4083bc80c5432d11ca636d333abf2cdd7c8/68747470733a2f2f676f6f2e676c2f375037433753)](https://travis-ci.org/PHPSnippets/CircularArray)[![Minimum PHP Version](https://camo.githubusercontent.com/1e262bb8fed785d7f06f16ac43031ce381f1e28a3e87846ac386941c8bea95bd/68747470733a2f2f676f6f2e676c2f4431336a4e67)](https://php.net/)[![Release](https://camo.githubusercontent.com/067375e05e93b17556adbf77026b956ea29d04f542d611c930d57b14d47c79ad/68747470733a2f2f676f6f2e676c2f53706e596358)](https://packagist.org/packages/php-snippets/circular-array)[![Coverage Status](https://camo.githubusercontent.com/4a918d0f038efb8fd951231af5ce7ccafbafcd2733774c78f15864154bdc7066/68747470733a2f2f676f6f2e676c2f323575394634)](https://scrutinizer-ci.com/g/PHPSnippets/CircularArray/code-structure)[![Quality Score](https://camo.githubusercontent.com/08e880703e848cc35abc48d29065a863d6ceddc047bfad3c6f29e505a03f29c0/68747470733a2f2f676f6f2e676c2f52586b314a79)](https://scrutinizer-ci.com/g/PHPSnippets/CircularArray)[![Software License](https://camo.githubusercontent.com/40345626964b99957698ea0b7c6d3a0a38b9ab84dd0eb2f0aca070d2d96dfd04/68747470733a2f2f676f6f2e676c2f5148746e7135)](LICENSE.md)

[![](https://camo.githubusercontent.com/04d667f879833e1621f4f39ab23967ed6f075ad9ce9318be39f49cfbcb16897f/68747470733a2f2f676f6f2e676c2f484763646642)](https://camo.githubusercontent.com/04d667f879833e1621f4f39ab23967ed6f075ad9ce9318be39f49cfbcb16897f/68747470733a2f2f676f6f2e676c2f484763646642)Image: [Cburnett](https://goo.gl/fCsXZT)From [Wikipedia](https://en.wikipedia.org/wiki/Circular_buffer):

> A [circular buffer](http://www.mathcs.emory.edu/~cheung/Courses/171/Syllabus/8-List/array-queue2.html), circular queue, cyclic buffer or ring buffer is a data structure that uses a single, [fixed-size buffer](http://php.net/manual/pt_BR/class.splfixedarray.php) as if it were connected end-to-end. This structure lends itself easily to buffering data streams.

Install
-------

[](#install)

Via Composer

```
$ composer require php-snippets/circular-array
```

Usage
-----

[](#usage)

You can create an array where an interaction occurs indefinitely:

```
use PHPSnippets\DataStructures\CircularArray;

$circular = Circular::fromArray(array(1, 2, 3, 4));

// this foreach never ends, after 4 back to 1.
foreach($circular as $value){
    echo $value;
}
```

Requirements
------------

[](#requirements)

The following versions of PHP are supported by this version.

- PHP &gt;= 5.3

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Credits
-------

[](#credits)

- [Webysther Nunes](https://github.com/Webysther)
- [All Contributors](https://github.com/PHPSnippets/CircularArray/contributors)

License
-------

[](#license)

MIT. Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3126d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a508e4c846549c2b55bf4f5ceb2d762ce6365c5ada4f94d21921e19b8b4af89?d=identicon)[Webysther](/maintainers/Webysther)

---

Top Contributors

[![webysther](https://avatars.githubusercontent.com/u/750007?v=4)](https://github.com/webysther "webysther (23 commits)")

---

Tags

arraybuffercircularcyclicdata-structuresfixedphpqueuearraycircular

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-snippets-circular-array/health.svg)

```
[![Health](https://phpackages.com/badges/php-snippets-circular-array/health.svg)](https://phpackages.com/packages/php-snippets-circular-array)
```

###  Alternatives

[ramsey/collection

A PHP library for representing and manipulating collections.

1.2k486.0M69](/packages/ramsey-collection)[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2228.8M171](/packages/react-async)[react/promise-stream

The missing link between Promise-land and Stream-land for ReactPHP

11512.9M45](/packages/react-promise-stream)[illuminate/bus

The Illuminate Bus package.

6043.8M409](/packages/illuminate-bus)

PHPackages © 2026

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