PHPackages                             asan/nsq-swoole - 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. asan/nsq-swoole

ActiveLibrary

asan/nsq-swoole
===============

PHP client for NSQ with Swoole

v1.3(8y ago)132433[1 issues](https://github.com/Janson-Leung/nsq-swoole/issues)[1 PRs](https://github.com/Janson-Leung/nsq-swoole/pulls)MITPHPPHP &gt;=5.4

Since Jun 2Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Janson-Leung/nsq-swoole)[ Packagist](https://packagist.org/packages/asan/nsq-swoole)[ Docs](https://github.com/Janson-Leung/nsq-swoole)[ RSS](/packages/asan-nsq-swoole/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)DependenciesVersions (6)Used By (0)

NSQ-SWOOLE
==========

[](#nsq-swoole)

PHP Swoole client for [NSQ](https://github.com/bitly/nsq).

### Requirements

[](#requirements)

- PHP 5.4 or higher
- Swoole 1.8.6 or higher

### Installation

[](#installation)

```
composer require asan/nsq-swoole

```

### Testing it out

[](#testing-it-out)

Publish:

```
php tests/PublishTest.php

```

Subscribe:

```
php tests/SubscribeTest.php

```

### Publishing

[](#publishing)

The client supports publishing to N `nsqd` servers. which must be specified explicitly by hostname. And supports publishing multiple messages.

```
$client = new Asan\Nsq\Client;

$client->publishTo([
    ['host' => 'localhost', 'port' => 4150]
])->publish('test', 'single message');

//multiple messages
$client->publish('test', ['message one', 'message two']);

//HA publishing:
$client->publishTo([
    ['host' => 'nsq1', 'port' => 4150],
    ['host' => 'nsq2', /*'port' => 4150*/]
], Asan\Nsq\Client::PUB_QUORUM)->publish('test', 'HA publishing message');
```

### Subscribing

[](#subscribing)

The client supports subscribing from N `nsqd` servers, each of which will be auto-discovered from one or more `nslookupd` servers. The way this works is that `nslookupd` is able to provide a list of auto-discovered nodes hosting messages for a given topic.

```
$lookup = new Asan\Nsq\Lookup\Lookupd([
    ['host' => 'nsq1', 'port' => 4161],
    ['host' => 'nsq2', /*'port' => 4161*/]
]);

$client = new Asan\Nsq\Client;

$client->subscribe($lookup, 'test', 'web', function($moniter, $msg) {
    echo sprintf("READ\t%s\t%s\n", $msg->getId(), $msg->getPayload());
});
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

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 ~6 days

Total

5

Last Release

3243d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4264643?v=4)[Asan](/maintainers/Janson-Leung)[@Janson-Leung](https://github.com/Janson-Leung)

---

Top Contributors

[![Janson-Leung](https://avatars.githubusercontent.com/u/4264643?v=4)](https://github.com/Janson-Leung "Janson-Leung (3 commits)")

### Embed Badge

![Health badge](/badges/asan-nsq-swoole/health.svg)

```
[![Health](https://phpackages.com/badges/asan-nsq-swoole/health.svg)](https://phpackages.com/packages/asan-nsq-swoole)
```

PHPackages © 2026

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