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. [HTTP &amp; Networking](/categories/http)
4. /
5. asan/nsq-swoole

ActiveLibrary[HTTP &amp; Networking](/categories/http)

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

PHP client for NSQ with Swoole

v1.3(9y ago)132433[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 2w 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

31

—

LowBetter than 66% of packages

Maintenance20

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

3291d 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)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M81](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.7k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M89](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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