PHPackages                             axguowen/think-redisqueue - 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. axguowen/think-redisqueue

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

axguowen/think-redisqueue
=========================

Simple Redis Queue For ThinkPHP

044PHP

Since Jul 24Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/axguowen/think-redisqueue)[ Packagist](https://packagist.org/packages/axguowen/think-redisqueue)[ RSS](/packages/axguowen-think-redisqueue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ThinkPHP Redis消息队列扩展
====================

[](#thinkphp-redis消息队列扩展)

一个简单的ThinkPHP Redis消息队列扩展，定时功能基于Workerman4.1开发

支持多队列

支持多进程

安装
--

[](#安装)

```
composer require axguowen/think-redisqueue

```

配置
--

[](#配置)

首先配置config目录下的redisqueue.php配置文件。 配置项说明：

```
return [
    // 队列Worker实例名称
    'name' => 'think-redisqueue',
    // Redis连接配置
    'connection' => 'localhost',
    // 是否以守护进程启动
    'daemonize' => false,
    // Redis键名存储有效期
    'storage_expire' => 0,
    // 内容输出文件路径
    'stdout_file' => '',
    // pid文件路径
    'pid_file' => '',
    // 日志文件路径
    'log_file' => '',
    // 队列列表
    'queue_list' => [
        [
            // 队列ID
            'id' => 1,
            // 队列名称
            'name' => '执行闭包函数',
            // 进程数量
            'count' => 1,
            // 执行器，支持闭包、类的动态方法、类的静态方法，支持参数依赖注入
            'handler' => function(array $data, \think\App $app){
                echo 'ThinkPHP v' . $app->version() . PHP_EOL;
            }
        ],
        [
            // 队列ID
            'id' => 2,
            // 队列名称
            'name' => '执行类的静态方法',
            // 进程数量
            'count' => 1,
            // 执行器，支持闭包、类的动态方法、类的静态方法，支持参数依赖注入
            'handler' => \app\redisqueue\Handler::class . '::staticMethod',
        ],
        [
            // 队列ID
            'id' => 3,
            // 队列名称
            'name' => '执行类的动态方法',
            // 进程数量
            'count' => 1,
            // 这里实例化Handler类后执行publicMethod方法
            'handler' => [\app\redisqueue\Handler::class, 'publicMethod'],
        ],
        [
            // 队列ID
            'id' => 4,
            // 队列名称
            'name' => '不指定动态方法则默认执行类的handle方法',
            // 进程数量
            'count' => 1,
            // 是否禁用
            'disabled' => 1,
            // 此时\app\redisqueue\Handler类中必须要有handle方法
            'handler' => \app\redisqueue\Handler::class,
        ],
    ],
];
```

启动停止
----

[](#启动停止)

队列的启动停止均在命令行控制台操作，所以首先需要在控制台进入tp目录

### 启动命令

[](#启动命令)

```
php think redisqueue start

```

要使用守护进程模式启动可以将配置项deamonize设置为true 或者在启动命令后面追加 -d 参数，如下：

```
php think redisqueue start -d

```

### 停止

[](#停止)

```
php think redisqueue stop

```

### 查看进程状态

[](#查看进程状态)

```
php think redisqueue status

```

### 向队列中发送数据

[](#向队列中发送数据)

```
use think\facade\RedisQueue;

// 队列数据
$queueData = ['name' => 'zhangsan'];
// 向队列发送数据
$result = \think\facade\RedisQueue::send(1, $queueData);
// 输出结果
echo $result;
```

注意
--

[](#注意)

Windows下不支持多进程设置，也不支持守护进程方式运行，正式生产环境请用Linux

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance40

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity14

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5bb2b3388238042a25cf42dc44e5ff84adc241510354abae9e91573556753205?d=identicon)[axguowen](/maintainers/axguowen)

---

Top Contributors

[![axguowen](https://avatars.githubusercontent.com/u/61955804?v=4)](https://github.com/axguowen "axguowen (11 commits)")

### Embed Badge

![Health badge](/badges/axguowen-think-redisqueue/health.svg)

```
[![Health](https://phpackages.com/badges/axguowen-think-redisqueue/health.svg)](https://phpackages.com/packages/axguowen-think-redisqueue)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[amphp/parser

A generator parser to make streaming parsers simple.

14952.8M16](/packages/amphp-parser)[amphp/serialization

Serialization tools for IPC and data storage in PHP.

13451.1M18](/packages/amphp-serialization)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[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

2238.8M171](/packages/react-async)

PHPackages © 2026

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