PHPackages                             bardoqi/circular-linked-list - 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. bardoqi/circular-linked-list

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

bardoqi/circular-linked-list
============================

circular dual linked list based on php array and iterator patten.

0.1.1(5y ago)23MITPHPPHP &gt;=7.2

Since Jun 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/BardoQi/circular-linked-list)[ Packagist](https://packagist.org/packages/bardoqi/circular-linked-list)[ Docs](https://github.com/bardoqi/circular-linked-list)[ RSS](/packages/bardoqi-circular-linked-list/feed)WikiDiscussions master Synced 4w ago

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

Circular Linked List
====================

[](#circular-linked-list)

环形链表
====

[](#环形链表)

简介
--

[](#简介)

本组件基于设计模式中的迭代器模式，通过代码实现，够将数组当成环形链表来使用。 因为，PHP现在增加了生成器函数Yield，因而大大方便了环形链表的开发。 也许你会问，这个库有什么用？ 最常见的应用场景有：

- 地理数据中的边界多边形，如果要进行特征数据计算时，则会相当方便。
- 动态图表显示时，常常是用环形链表显示所有数据，并且动态更新开始位置，结束位置，动态用新数据覆盖旧数据。
- 其它可能需要的场景

特性
--

[](#特性)

- 支持带接头的数组。比如地理数据多边形就有接头，最后一个元素与第一个是相同的。最后一个就是接头。
- 支持元素更新，查找，插入，移除，添加等操作。
- 支持顺序迭代 nextItems() 与逆序迭代 prevItems()，
- 支持多圈迭代 nextItemsWithCount() prevItemsWithCout()，
- 支持任意整数的开始位置与结束位置
- 具有双向链表完全特性，可以通过，nextItem()和prevItem() 获取前一元素以下后面元素。nextKey()和prevKey() 获以前一元素和后一元素的Key
- 支持队列所需的特性，具有push,pop,shift,unshift操作，且队列也支持接头。
- 函数清单
    - getKey($key)
    - nextKey($key)
    - prevKey($key)
    - nextItems($from, $to)
    - nextItemsWithCount($from, $count)
    - prevItems($from, $to)
    - prevItemsWithCount($from, $count)
    - nextItem($key)
    - prevItem($key)
    - prevCount($from,$to)
    - nextCount($from,$to)
    - getItem($key)
    - setAt($pos,$value)
    - add($value)
    - push($value)
    - pop()
    - shift()
    - unshift($value)
    - insertAt($pos,$value)
    - removeAt($pos)
    - isNeighbours($keyA,$keyB)
    - count()
    - isEmpty()
    - size()
    - findByPos($pos)
    - find($value,$strict=false)
    - toArray()

安装
--

[](#安装)

```
$ composer require "bardoqi/circular-linked-list"
```

代码示例
----

[](#代码示例)

- 参考/test中的源码

作者
--

[](#作者)

Bardeen QI

版权
--

[](#版权)

MIT

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

2140d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bfb2d0271845406a6b777d824993d97eec9f249b61ffa43b86994698b988e30?d=identicon)[bardoqi](/maintainers/bardoqi)

---

Top Contributors

[![BardoQi](https://avatars.githubusercontent.com/u/409367?v=4)](https://github.com/BardoQi "BardoQi (5 commits)")

---

Tags

data structurecircular linked listiterator pattenarray in ring

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bardoqi-circular-linked-list/health.svg)

```
[![Health](https://phpackages.com/badges/bardoqi-circular-linked-list/health.svg)](https://phpackages.com/packages/bardoqi-circular-linked-list)
```

###  Alternatives

[loophp/phptree

An implementation of tree data structure

981.8M2](/packages/loophp-phptree)[equip/structure

Simple, immutable data structures

40201.9k2](/packages/equip-structure)

PHPackages © 2026

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