PHPackages                             cheungd/laravel-cached-priority-queue - 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. cheungd/laravel-cached-priority-queue

ActiveLibrary

cheungd/laravel-cached-priority-queue
=====================================

Cached priority queue for Laravel Framework

144PHP

Since Mar 31Pushed 8y ago1 watchersCompare

[ Source](https://github.com/davycheung/laravel-cached-priority-queue)[ Packagist](https://packagist.org/packages/cheungd/laravel-cached-priority-queue)[ RSS](/packages/cheungd-laravel-cached-priority-queue/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Cached Priority Queue
-----------------------------

[](#laravel-cached-priority-queue)

A Priority Queue for the Laravel Framework. Easy to install, use, and store. A nice wrapper for PHP's SplPriorityQueue class.

Install
-------

[](#install)

```
composer require cheungd/laravel-cached-priority-queue

```

Configuration
-------------

[](#configuration)

Find the `aliases` array in `config/app.php` and add the following:

```
    'aliases' => [
    	...
    	'CachedPriorityQueue' => DavidCheung\LaravelCachedPriorityQueue\CachedPriorityQueue::class,
    ],

```

Usage
-----

[](#usage)

Initializing and interacting with the queue:

```
use CachedPriorityQueue;

//load the priority queue from cache if key exists
$queue = new CachedPriorityQueue('my_key');

//creates queue: [John, David, Mike, Will]
$queue->insert('Mike', 5);
$queue->insert('Will', 5);
$queue->insert('John', 1);
$queue->insert('David', 1);

//Will retrieve the first item 'John', but remains in queue
//resulting queue: [John, David, Mike, Will]
$item = $queue->peek();

//Will retrieve the first item 'John', and removes from queue
//result queue: [David, Mike, Will]
$item = $queue->remove();

//save in cache with key 'my_key'
$queue->save();

```

Iterator:

```
$queue = new CachedPriorityQueue('my_key');

//[John, David, Mike, Will]
$queue->insert('Mike', 5);
$queue->insert('Will', 5);
$queue->insert('John', 1);
$queue->insert('David', 1)

$object = $queue->toArray();
/**
array:4 [
  0 => {
    "data": "John"
    "priority": 1
  }
  1 => {
    "data": "David"
    "priority": 1
  }
  2 => {
    "data": "Mike"
    "priority": 5
  }
  3 => {
    "data": "Will"
    "priority": 5
  }
]
**/

```

License
-------

[](#license)

This software is licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d3cec0efe07b25fa240998100a48f20f816e49d0ce567109141a2c55152cfd5?d=identicon)[realdavidcheung@gmail.com](/maintainers/realdavidcheung@gmail.com)

---

Top Contributors

[![davycheung](https://avatars.githubusercontent.com/u/4220987?v=4)](https://github.com/davycheung "davycheung (8 commits)")

---

Tags

laravel-frameworkpriority-queue

### Embed Badge

![Health badge](/badges/cheungd-laravel-cached-priority-queue/health.svg)

```
[![Health](https://phpackages.com/badges/cheungd-laravel-cached-priority-queue/health.svg)](https://phpackages.com/packages/cheungd-laravel-cached-priority-queue)
```

PHPackages © 2026

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