PHPackages                             tttlkkkl/php\_nsq\_client - 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. tttlkkkl/php\_nsq\_client

ActiveLibrary

tttlkkkl/php\_nsq\_client
=========================

php nsq client

2.2.5(6y ago)92.5kMITPHPPHP &gt;=5.6

Since Jun 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/tttlkkkl/nsq_swoole_client)[ Packagist](https://packagist.org/packages/tttlkkkl/php_nsq_client)[ RSS](/packages/tttlkkkl-php-nsq-client/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)DependenciesVersions (7)Used By (0)

\#nsq\_swoole\_client 基于swoole实现的NSQ客户端。支持sub、pub、mPub、auth。 lumen 下的使用实例（laravel同理）：[github](https://github.com/tttlkkkl/swoole-nsq)。

```
composer require "tttlkkkl/php_nsq_client:~2.2.4" -vvv

```

- 消息去重、重新排队的机机制、日志等都可以通过实现已定义的接口去中心实现。一般情况下只需要实现消息处理方法即可。
- 默认实现的消费客户端构造方法参数 `$finishAuto` 为 `true` 时，如果 `handle` 方法返回`false`或者抛出任何异常都将自动根据`requeue` 对象重新排队。
- 如果已对`message`对象调用了`finish()`或者 `requeue()`方法并且失败时,走 `$finishAuto` 为 `true` 时的逻辑。
- `$finishAuto` 为 `false` 时,必须手动调用`finish()`或者 `requeue()`。
- `helper` 目录中封装了常用的`http` `pub`和`mpub`。

### 示例：

[](#示例)

```
    $lookupHost = '127.0.0.1:4160';
    $topic = $channel = 'test';
    // 重复排队10次，每次50秒延时下发
    $reQueue = new \NsqClient\lib\requeue\Requeue(10, 50);
    $client = new Client(
        $topic,
        $channel,
        '',
        function (\NsqClient\lib\message\Message &$message) {
            echo "收到消息:{$message->getId()}\n";
            $message->finish();
        },
        true,
        null,
        $reQueue,
        [
            'heartbeat_interval' => 1000//1秒的心跳间隔
        ]
    );
    // 开启的工作进程数
    $workNum = 2;
    (new NsqClient())->init($client, $lookupHost, $workNum);giot
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Every ~90 days

Total

5

Last Release

2521d ago

Major Versions

1.1.0 → 2.2.02019-05-22

### Community

---

Top Contributors

[![tttlkkkl](https://avatars.githubusercontent.com/u/8353103?v=4)](https://github.com/tttlkkkl "tttlkkkl (25 commits)")

### Embed Badge

![Health badge](/badges/tttlkkkl-php-nsq-client/health.svg)

```
[![Health](https://phpackages.com/badges/tttlkkkl-php-nsq-client/health.svg)](https://phpackages.com/packages/tttlkkkl-php-nsq-client)
```

PHPackages © 2026

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