All Projects → Superbalist → php-pubsub

Superbalist / php-pubsub

Licence: MIT License
A PHP abstraction for the pub-sub pattern

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to php-pubsub

php-pubsub-kafka
A Kafka adapter for the php-pubsub package
Stars: ✭ 26 (-27.78%)
Mutual labels:  pubsub, superbalist, php-pubsub
php-pubsub-redis
A Redis adapter for the php-pubsub package
Stars: ✭ 24 (-33.33%)
Mutual labels:  superbalist, php-pubsub
wsapix
Next generation Websocket framework for nodejs
Stars: ✭ 17 (-52.78%)
Mutual labels:  pubsub
megaphone
Hear ye, hear ye 📣
Stars: ✭ 15 (-58.33%)
Mutual labels:  pubsub
subee
✉️ 🐝 It's not only a bee, but a message - Pub/Sub Worker Framework Implementation
Stars: ✭ 40 (+11.11%)
Mutual labels:  pubsub
azure-webpubsub
Azure Web PubSub Service helps you to manage WebSocket connections and do publish and subscribe in an easy way
Stars: ✭ 86 (+138.89%)
Mutual labels:  pubsub
libmcu
A toolkit for firmware development
Stars: ✭ 33 (-8.33%)
Mutual labels:  pubsub
fpEs
Functional Programming for EcmaScript(Javascript)
Stars: ✭ 40 (+11.11%)
Mutual labels:  pubsub
liftbridge-api
Protobuf definitions for the Liftbridge gRPC API. https://github.com/liftbridge-io/liftbridge
Stars: ✭ 15 (-58.33%)
Mutual labels:  pubsub
celery-connectors
Want to handle 100,000 messages in 90 seconds? Celery and Kombu are that awesome - Multiple publisher-subscriber demos for processing json or pickled messages from Redis, RabbitMQ or AWS SQS. Includes Kombu message processors using native Producer and Consumer classes as well as ConsumerProducerMixin workers for relay publish-hook or caching
Stars: ✭ 37 (+2.78%)
Mutual labels:  pubsub
js-libp2p-gossipsub
JavaScript implementation of Gossipsub
Stars: ✭ 76 (+111.11%)
Mutual labels:  pubsub
glitch
!NO MORE MAINTAINED! Reactive API Wrapper for Twitch in Kotlin/JVM
Stars: ✭ 12 (-66.67%)
Mutual labels:  pubsub
pulsar-adapters
Apache Pulsar Adapters
Stars: ✭ 18 (-50%)
Mutual labels:  pubsub
flask-redis-realtime-chat
A simple Flask realtime chat using Redis PubSub
Stars: ✭ 31 (-13.89%)
Mutual labels:  pubsub
sharding-p2p-poc
Proof of Concept of Ethereum Serenity Peer-to-Peer Layer on libp2p PubSub System
Stars: ✭ 35 (-2.78%)
Mutual labels:  pubsub
sol
Lightweight MQTT broker, written from scratch. IO is handled by a super simple event loop based upon the most common IO multiplexing implementations.
Stars: ✭ 72 (+100%)
Mutual labels:  pubsub
go-aws-msg
AWS Pub/Sub Primitives for Go
Stars: ✭ 22 (-38.89%)
Mutual labels:  pubsub
core-api
Streamr Core backend
Stars: ✭ 52 (+44.44%)
Mutual labels:  pubsub
build-your-own-platform-with-knative
Knativeのコンポーネントを理解しながらFaaSプラットフォームをDIYするワークショップです
Stars: ✭ 43 (+19.44%)
Mutual labels:  pubsub
mros2
agent-less and lightweight communication library compatible with rclcpp for embedded devices
Stars: ✭ 72 (+100%)
Mutual labels:  pubsub

php-pubsub

A PHP abstraction for the pub-sub pattern

Author Build Status StyleCI Software License Packagist Version Total Downloads

Installation

composer require superbalist/php-pubsub

Adapters

Integrations

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

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

You can easily write your own custom adapter by implementing the PubSubAdapterInterface 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

The library comes with examples for all adapters and a 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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].