PHPackages                             superbalist/php-pubsub - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. superbalist/php-pubsub

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

superbalist/php-pubsub
======================

An adapter based PubSub package for PHP

2.0.0(9y ago)45587.5k↓67.3%5[1 PRs](https://github.com/Superbalist/php-pubsub/pulls)19MITPHPPHP &gt;=5.6.0

Since Sep 2Pushed 3y ago6 watchersCompare

[ Source](https://github.com/Superbalist/php-pubsub)[ Packagist](https://packagist.org/packages/superbalist/php-pubsub)[ RSS](/packages/superbalist-php-pubsub/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (19)

php-pubsub
==========

[](#php-pubsub)

A PHP abstraction for the pub-sub pattern

[![Author](https://camo.githubusercontent.com/abd4e3e2e71081ad01ef09a60c49d70c5e0677497f38918e740703cd02605078/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40737570657262616c6973742d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/superbalist)[![Build Status](https://camo.githubusercontent.com/21539a2ed3726066e347b134ca27d562bd819f1c5cf6bd742175edb995be93fd/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f537570657262616c6973742f7068702d7075627375622f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Superbalist/php-pubsub)[![StyleCI](https://camo.githubusercontent.com/ece7c2ae76a794cf8458a6bb89ef2a88b1e34742f8bfa2e2833c1a4e3e236ebb/68747470733a2f2f7374796c6563692e696f2f7265706f732f36373235313738382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/67251788)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/b0511a5309e33dbd77d021fb995b72194323ab5e7fc4692b6d3462684640ff65/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737570657262616c6973742f7068702d7075627375622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/php-pubsub)[![Total Downloads](https://camo.githubusercontent.com/a70d47069dab2a236c85e4d5f4d461ea6c4705475db503a8f44b66f092439acb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737570657262616c6973742f7068702d7075627375622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/php-pubsub)

Installation
------------

[](#installation)

```
composer require superbalist/php-pubsub
```

Adapters
--------

[](#adapters)

- Local (bundled)
- /dev/null (bundled)
- Redis -
- Kafka -
- Google Cloud -
- HTTP -

Integrations
------------

[](#integrations)

Want to get started quickly? Check out some of these integrations:

- Laravel -

Usage
-----

[](#usage)

```
$adapter = new \Superbalist\PubSub\Adapters\LocalPubSubAdapter();

// consume messages
$adapter->subscribe('my_channel', function ($message) {
    var_dump($message);
});

// publish messages
$adapter->publish('my_channel', 'Hello World!');

// publish multiple messages
$messages = [
    'message 1',
    'message 2',
];
$adapter->publishBatch('my_channel', $messages);
```

Writing an Adapter
------------------

[](#writing-an-adapter)

You can easily write your own custom adapter by implementing the [PubSubAdapterInterface](src/PubSubAdapterInterface.php) interface.

Your adapter must implement the following methods:

```
/**
 * Subscribe a handler to a channel.
 *
 * @param string $channel
 * @param callable $handler
 */
public function subscribe($channel, callable $handler);

/**
 * Publish a message to a channel.
 *
 * @param string $channel
 * @param mixed $message
 */
public function publish($channel, $message);

/**
 * Publish multiple messages to a channel.
 *
 * @param string $channel
 * @param array $messages
 */
public function publishBatch($channel, array $messages);
```

Examples
--------

[](#examples)

The library comes with [examples](examples) for all adapters and a [Dockerfile](Dockerfile) for running the example scripts.

Run `make up`.

You will start at a `bash` prompt in the `/opt/php-pubsub` directory.

If you need another shell to publish a message to a blocking consumer, you can run `docker-compose run php-pubsub /bin/bash`

To run the examples:

```
$ php examples/LocalExample.php
```

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~255 days

Total

2

Last Release

3336d ago

Major Versions

1.0.0 → 2.0.02017-05-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b8f533cf5a84c29d3860ee32356f0554ead023247638ea952353fc2f01b2e5d?d=identicon)[superbalist](/maintainers/superbalist)

---

Top Contributors

[![matthewgoslett](https://avatars.githubusercontent.com/u/1571743?v=4)](https://github.com/matthewgoslett "matthewgoslett (18 commits)")[![shad0wfir3](https://avatars.githubusercontent.com/u/20926935?v=4)](https://github.com/shad0wfir3 "shad0wfir3 (3 commits)")

---

Tags

phpphp-pubsubpubsubsuperbalist

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/superbalist-php-pubsub/health.svg)

```
[![Health](https://phpackages.com/badges/superbalist-php-pubsub/health.svg)](https://phpackages.com/packages/superbalist-php-pubsub)
```

###  Alternatives

[truesocialmetrics/gearman-stats

Geaman connector for getting status and statistic data

1394.0k](/packages/truesocialmetrics-gearman-stats)

PHPackages © 2026

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