marko / broadcasting-amphp
Native async SSE broadcasting server on amphp for Marko Framework
Package info
github.com/marko-php/marko-broadcasting-amphp
Type:marko-module
pkg:composer/marko/broadcasting-amphp
Requires
- php: ^8.5
- amphp/amp: ^3
- amphp/byte-stream: ^2
- amphp/http-server: ^3
- amphp/pipeline: ^1
- marko/amphp: 0.11.0
- marko/authentication: 0.11.0
- marko/broadcasting: 0.11.0
- marko/clock: 0.11.0
- marko/config: 0.11.0
- marko/core: 0.11.0
- marko/log: 0.11.0
- marko/pubsub: 0.11.0
- psr/log: ^3
- revolt/event-loop: ^1
Requires (Dev)
- amphp/socket: ^2
- marko/pubsub-pgsql: 0.11.0
- marko/pubsub-redis: 0.11.0
- marko/testing: 0.11.0
- pestphp/pest: ^4.0
Suggests
- marko/pubsub-pgsql: PostgreSQL LISTEN/NOTIFY pub/sub driver (payloads are limited to 8000 bytes)
- marko/pubsub-redis: Redis pub/sub driver (recommended; fans events out across server processes)
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-09 21:31:00 UTC
README
Native async SSE broadcasting server --- a self-hosted, PHP-only realtime server on amphp that holds thousands of Server-Sent Events connections per process and fans events out through marko/pubsub.
Installation
composer require marko/broadcasting-amphp
This installs marko/broadcasting, marko/amphp and marko/pubsub. You also need a pub/sub driver such as marko/pubsub-redis, and a log driver.
Quick Example
use Marko\Broadcasting\PrivateChannel; // Publish (BroadcasterInterface is bound to AmphpBroadcaster): one pub/sub message, no HTTP call $broadcaster->broadcast('shows.42', 'seat.sold', ['seat' => 'A1']); // Give the browser an EventSource URL; private channels get a signed token $url = $amphpSubscriberToken->streamUrl(['shows.42', new PrivateChannel('orders.7')], $authManager->user());
marko broadcasting:serve --port=8085
Documentation
Full usage, API reference, and examples: marko/broadcasting-amphp