PHPackages                             lit/atd - 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. lit/atd

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

lit/atd
=======

基于Redis的延时队列

v0.0.1(5y ago)19.9k↓43.8%PHPPHP &gt;=5.6.0

Since Jan 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ghostong/LitAtd)[ Packagist](https://packagist.org/packages/lit/atd)[ RSS](/packages/lit-atd/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

延时队列 atd
--------

[](#延时队列-atd)

### 变量解释

[](#变量解释)

```
$redisHandler;  //redis链接句柄, Task与listen 使用时需长连接
$topic; //话题
$topics; //话题数组
$message; //消息体
```

### 启动服务

[](#启动服务)

```
//连接redis
$redisHandler = new \Redis();
$redisHandler->pconnect("192.168.1.163"); //需使用长连接

//延时队列服务
\Lit\Atd\Task::init($redisHandler)->run();
```

### 发布一条延时消息

[](#发布一条延时消息)

```
use \Lit\Atd\Mapper\Message;

//连接redis
$redisHandler = new \Redis();
$redisHandler->connect("192.168.1.163");

//$message 消息体, 如果消息体重复会重置消息时间, 使用 $message->uniq_id 避免此问题
$message = new Message();
$message->topic = "topic1";
$message->body = "消息体!" ;;//. uniqid();
$message->uniq_id = ""; //唯一ID, 如果需要延期某条消息或者删除某条消息,需记录此ID
//$time 要执行的10位时间戳
$time = time() + 1;

var_dump(\Lit\Atd\Client::init($redisHandler)->at($time, $message));
```

### 消费延时队列

[](#消费延时队列)

```
//连接redis
$redisHandler = new \Redis();
$redisHandler->connect("192.168.1.163");

$topic = "topic1";
$msg = \Lit\Atd\Client::init($redisHandler)->pop($topic);
if (null !== $msg) {
    var_dump($msg->uniq_id, $msg->body, $msg->topic);
}
```

### 监听延时队列

[](#监听延时队列)

监听延时队列, 并使用回调函数执行相应操作

```
//连接redis
$redisHandler = new \Redis();
$redisHandler->pconnect("192.168.1.163"); //需使用长连接

//$topics 要监听的topic 必须为数组, 可同时监听多个 topic
$topics[] = "topic1";
$topics[] = "topic2";
\Lit\Atd\Client::init($redisHandler)->listen($topics, function (Message $message) {
    var_dump($message->topic, $message->body, $message->uniq_id);
});
```

### 删除未发布的消息

[](#删除未发布的消息)

```
use \Lit\Atd\Mapper\Message;

//连接redis
$redisHandler = new \Redis();
$redisHandler->connect("192.168.1.163");

//$message 消息体
$message = new Message();
$message->topic = "topic1";
$message->body = "消息体!";// . uniqid();
$message->uniq_id = ""; //唯一ID, 需和写入时的值相同

var_dump(\Lit\Atd\Client::init($redisHandler)->remove($message));
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

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

2004d ago

### Community

Maintainers

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

---

Top Contributors

[![ghostong](https://avatars.githubusercontent.com/u/5644948?v=4)](https://github.com/ghostong "ghostong (3 commits)")

---

Tags

atd

### Embed Badge

![Health badge](/badges/lit-atd/health.svg)

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

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.6M31](/packages/league-geotools)[illuminate/bus

The Illuminate Bus package.

6046.3M542](/packages/illuminate-bus)[uecode/qpush-bundle

Asynchronous processing for Symfony using Push Queues

1672.5M2](/packages/uecode-qpush-bundle)[belvg/module-sqs

N/A

1544.6k](/packages/belvg-module-sqs)[mayconbordin/l5-stomp-queue

Stomp Queue Driver for Laravel 5

121.1k](/packages/mayconbordin-l5-stomp-queue)

PHPackages © 2026

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