PHPackages                             nijens/sse - 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. nijens/sse

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

nijens/sse
==========

A Server Sent Events server implementation in PHP.

1.0.0(6y ago)25311MITPHPPHP ^7.2.9

Since Nov 7Pushed 3y ago2 watchersCompare

[ Source](https://github.com/nijens/sse)[ Packagist](https://packagist.org/packages/nijens/sse)[ RSS](/packages/nijens-sse/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

SSE
===

[](#sse)

[![Latest version on Packagist](https://camo.githubusercontent.com/8604785d5f08c8a779541631dd6ef8725f71ba84a101381d1d13634ecd87b7e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e696a656e732f7373652e737667)](https://packagist.org/packages/nijens/sse)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Build Status](https://github.com/nijens/sse/workflows/Continuous%20Integration/badge.svg)](https://github.com/nijens/sse/actions?workflow=Continuous+Integration)

A Server-Sent Events server implementation in PHP.

For more information about SSE, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).

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

[](#installation)

Open a command console, enter your project directory and execute:

```
composer require nijens/sse
```

Usage
-----

[](#usage)

The SSE library functions with two main components:

1. An event publisher implementation (eg. the `DateTimeEventPublisher`): Providing the events to be sent
2. The `SseKernel`: Responsible for checking with the event publisher for new events and sending the events to the client (browser)

The following example shows how to initialize the `SseKernel` with an event publisher:

```
