PHPackages                             boxphp/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. [Queues &amp; Workers](/categories/queues)
4. /
5. boxphp/queue

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

boxphp/queue
============

BoxPHP Queue - Redis Queue Implementation

1.0.0(today)00MITPHPPHP &gt;=8.1

Since Jun 27Pushed todayCompare

[ Source](https://github.com/tvjojo/boxphp-queue)[ Packagist](https://packagist.org/packages/boxphp/queue)[ RSS](/packages/boxphp-queue/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

boxphp/queue
============

[](#boxphpqueue)

BoxPHP 队列包 - 基于 Redis 的队列实现

安装
--

[](#安装)

```
composer require boxphp/queue
```

前置要求
----

[](#前置要求)

- boxphp/redis

使用
--

[](#使用)

### 基础使用

[](#基础使用)

```
use BoxPHP\Queue\Queue\RedisQueue;
use BoxPHP\Redis\Redis\RedisConnection;

$redis = new RedisConnection(['host' => '127.0.0.1', 'port' => 6379]);
$redis->connect();

$queue = new RedisQueue($redis, 'myapp');

// 推送任务
$queue->push(['job' => 'SendEmail', 'to' => 'user@example.com']);
$queue->push(['job' => 'ProcessImage', 'id' => 123]);

// 弹出任务
$job = $queue->pop();
if ($job) {
    // 处理任务
    processJob($job);
}

// 查看队列大小
echo $queue->size(); // 2
```

### 任务优先级

[](#任务优先级)

```
// 高优先级任务（推送到队列头部）
$queue->pushHigh(['job' => 'UrgentTask']);

// 普通任务
$queue->push(['job' => 'NormalTask']);

// 低优先级任务（推送到队列尾部）
$queue->pushLow(['job' => 'BackgroundTask']);
```

### 延迟任务

[](#延迟任务)

```
// 30秒后执行
$queue->delay(30, ['job' => 'DelayedTask']);

// 5分钟后执行
$queue->delay(300, ['job' => 'LaterTask']);
```

### 任务预览

[](#任务预览)

```
// 查看但不移除任务
$jobs = $queue->peek(0, 10); // 查看前10个任务
```

### 队列工作者

[](#队列工作者)

```
use BoxPHP\Queue\Queue\RedisQueue;

$queue = new RedisQueue($redis, 'myapp');

while (true) {
    $job = $queue->pop();

    if ($job === null) {
        sleep(1); // 队列为空，等待1秒
        continue;
    }

    try {
        // 处理任务
        processJob($job);

        // 处理成功，确认
        $queue->ack();
    } catch (\Exception $e) {
        // 处理失败，重新入队
        $queue->nack($job);
    }
}
```

依赖
--

[](#依赖)

- PHP &gt;= 8.1
- boxphp/core ^1.0
- boxphp/redis ^1.0

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9910314?v=4)[tvjojo ](/maintainers/tvjojo)[@tvjojo](https://github.com/tvjojo)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/boxphp-queue/health.svg)

```
[![Health](https://phpackages.com/badges/boxphp-queue/health.svg)](https://phpackages.com/packages/boxphp-queue)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.5M29](/packages/league-geotools)[illuminate/bus

The Illuminate Bus package.

6045.5M507](/packages/illuminate-bus)[uecode/qpush-bundle

Asynchronous processing for Symfony using Push Queues

1672.5M2](/packages/uecode-qpush-bundle)[jayazhao/think-queue-rabbitmq

为 ThinkPHP5.1 队列增加 RabbitMQ 驱动

141.5k](/packages/jayazhao-think-queue-rabbitmq)

PHPackages © 2026

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