marko / sse
Server-Sent Events (SSE) support for Marko Framework
0.0.1
2026-03-25 17:53 UTC
Requires
- php: ^8.5
- marko/core: 0.0.1
- marko/routing: 0.0.1
Requires (Dev)
- marko/testing: 0.0.1
- pestphp/pest: ^4.0
Suggests
- marko/pubsub: For real-time pub/sub-driven SSE streams
This package is auto-updated.
Last update: 2026-03-25 21:07:44 UTC
README
Server-Sent Events for Marko — push real-time updates to browsers without WebSockets.
Installation
composer require marko/sse
Quick Example
use Marko\Sse\SseEvent; use Marko\Sse\SseStream; use Marko\Sse\StreamingResponse; $stream = new SseStream( dataProvider: function () use (&$lastEventId): array { $messages = $this->messages->findSince($lastEventId); return array_map(fn ($msg) => new SseEvent( data: ['id' => $msg->id, 'text' => $msg->body], event: 'message', id: $msg->id, ), $messages); }, pollInterval: 1, timeout: 300, ); return new StreamingResponse($stream);
Documentation
Full usage, API reference, and examples: marko/sse