PHPackages                             simbiot1954/nats - 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. simbiot1954/nats

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

simbiot1954/nats
================

A nats.io client in PHP

0.8.7.2(8y ago)02.0kMITPHP

Since Jun 28Pushed 8y ago1 watchersCompare

[ Source](https://github.com/SimBioT1954/phpnats)[ Packagist](https://packagist.org/packages/simbiot1954/nats)[ RSS](/packages/simbiot1954-nats/feed)WikiDiscussions develop Synced 2w ago

READMEChangelogDependencies (1)Versions (37)Used By (0)

Introduction
------------

[](#introduction)

A PHP client for the [NATS messaging system](https://nats.io).

Requirements
------------

[](#requirements)

- php 7.1+
- [gnatsd](https://github.com/apcera/gnatsd)

### Basic Usage

[](#basic-usage)

```
$client = new \Nats\Connection();
$client->connect();

// Publish Subscribe

// Simple Subscriber.
$client->subscribe(
    'foo',
    function ($message) {
        printf("Data: %s\r\n", $message->getBody());
    }
);

// Simple Publisher.
$client->publish('foo', 'Marty McFly');

// Wait for 1 message.
$client->wait(1);

// Request Response

// Responding to requests.
$sid = $client->subscribe(
    'sayhello',
    function ($message) {
        $message->reply('Reply: Hello, '.$message->getBody().' !!!');
    }
);

// Request.
$client->request(
    'sayhello',
    'Marty McFly',
    function ($message) {
        echo $message->getBody();
    }
);
```

### Encoded Connections

[](#encoded-connections)

```
$encoder = new \Nats\Encoders\JSONEncoder();
$options = new \Nats\ConnectionOptions();
$client = new \Nats\EncodedConnection($options, $encoder);
$client->connect();

// Publish Subscribe

// Simple Subscriber.
$client->subscribe(
    'foo',
    function ($payload) {
        printf("Data: %s\r\n", $payload->getBody()[1]);
    }
);

// Simple Publisher.
$client->publish(
    'foo',
    [
     'Marty',
     'McFly',
    ]
);

// Wait for 1 message.
$client->wait(1);

// Request Response

// Responding to requests.
$sid = $client->subscribe(
    'sayhello',
    function ($message) {
        $message->reply('Reply: Hello, '.$message->getBody()[1].' !!!');
    }
);

// Request.
$client->request(
    'sayhello',
    [
     'Marty',
     'McFly',
    ],
    function ($message) {
        echo $message->getBody();
    }
);
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 80.6% 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 ~34 days

Recently: every ~71 days

Total

31

Last Release

2995d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5832702?v=4)[JBI](/maintainers/SimBioT)[@simbiot](https://github.com/simbiot)

---

Top Contributors

[![repejota](https://avatars.githubusercontent.com/u/36673?v=4)](https://github.com/repejota "repejota (261 commits)")[![dfeyer](https://avatars.githubusercontent.com/u/221173?v=4)](https://github.com/dfeyer "dfeyer (16 commits)")[![byrnedo](https://avatars.githubusercontent.com/u/5528491?v=4)](https://github.com/byrnedo "byrnedo (15 commits)")[![adriacidre](https://avatars.githubusercontent.com/u/593270?v=4)](https://github.com/adriacidre "adriacidre (12 commits)")[![octante](https://avatars.githubusercontent.com/u/1949683?v=4)](https://github.com/octante "octante (6 commits)")[![josgilmo](https://avatars.githubusercontent.com/u/773565?v=4)](https://github.com/josgilmo "josgilmo (4 commits)")[![gorkaio](https://avatars.githubusercontent.com/u/4482916?v=4)](https://github.com/gorkaio "gorkaio (2 commits)")[![SimBioT1954](https://avatars.githubusercontent.com/u/11522338?v=4)](https://github.com/SimBioT1954 "SimBioT1954 (1 commits)")[![xsuperbug](https://avatars.githubusercontent.com/u/7601737?v=4)](https://github.com/xsuperbug "xsuperbug (1 commits)")[![anthonysterling](https://avatars.githubusercontent.com/u/159960?v=4)](https://github.com/anthonysterling "anthonysterling (1 commits)")[![ipadavic](https://avatars.githubusercontent.com/u/2059817?v=4)](https://github.com/ipadavic "ipadavic (1 commits)")[![netroby](https://avatars.githubusercontent.com/u/154278046?v=4)](https://github.com/netroby "netroby (1 commits)")[![olivermack](https://avatars.githubusercontent.com/u/666035?v=4)](https://github.com/olivermack "olivermack (1 commits)")[![omack](https://avatars.githubusercontent.com/u/1389984?v=4)](https://github.com/omack "omack (1 commits)")[![sergeyklay](https://avatars.githubusercontent.com/u/1256298?v=4)](https://github.com/sergeyklay "sergeyklay (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/simbiot1954-nats/health.svg)

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

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

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/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

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

PHPackages © 2026

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