PHPackages                             itzyanick/sselib - 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. itzyanick/sselib

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

itzyanick/sselib
================

A PHP SSE Lib

1.0.0(5y ago)05MITPHPPHP &gt;=5.4CI failing

Since Oct 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ItzYanick/SSELIB)[ Packagist](https://packagist.org/packages/itzyanick/sselib)[ Docs](https://github.com/itzyanick/sselib)[ RSS](/packages/itzyanick-sselib/feed)WikiDiscussions master Synced 6d ago

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

SSE Lib
=======

[](#sse-lib)

A library to create real-time server-sent events on your own PHP Server. On the client side you can use a simple and easy to use javascript to get the events in real-time.

Requirements
------------

[](#requirements)

- PHP 5.4 or later

Installation via Composer
-------------------------

[](#installation-via-composer)

```
$ composer require itzyanick/sselib
```

Usage
-----

[](#usage)

### Server Code example (PHP)

[](#server-code-example-php)

```
use ItzYanick\SSELIB\Server;
use ItzYanick\SSELIB\Event;

header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
header('Connection: keep-alive');
header('X-Accel-Buffering: no'); // optional

$dataCallback = function ($var, $prevData) {
    $push = ['content' => 'Fools'];
    if (empty($push)) {
        return false;
    }
    return [json_encode(compact('push')), json_encode(compact('push'))];
};

$abortCallback = function () {

};

$server = new Server();
$server->setEvent(new Event($dataCallback, 'data', 'var', $abortCallback));
$server->startServer(0);
```

### Start the Server Example

[](#start-the-server-example)

```
$ php -S 127.0.0.1:9001 -t .
```

### Client Code example (Javascript)

[](#client-code-example-javascript)

```
const source = new EventSource('http://127.0.0.1:9001/sse.php', {withCredentials:true});
source.addEventListener('data', function(event) {
    console.log(event.data);
    // source.close(); // disconnect stream
}, false);
```

License
-------

[](#license)

[MIT](https://github.com/itzyanick/sselib/blob/master/LICENSE)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2032d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18502828?v=4)[Yanick](/maintainers/ItzYanick)[@ItzYanick](https://github.com/ItzYanick)

---

Top Contributors

[![ItzYanick](https://avatars.githubusercontent.com/u/18502828?v=4)](https://github.com/ItzYanick "ItzYanick (23 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/itzyanick-sselib/health.svg)

```
[![Health](https://phpackages.com/badges/itzyanick-sselib/health.svg)](https://phpackages.com/packages/itzyanick-sselib)
```

###  Alternatives

[suncat/mobile-detect-bundle

Symfony2/3/4 bundle for detect mobile devices, managing mobile view types, redirect to mobile version.

4035.3M7](/packages/suncat-mobile-detect-bundle)[snowdog/frontools

Set of front-end tools for Magento 2, based on Gulp.js

4241.3M1](/packages/snowdog-frontools)[spatie/laravel-dashboard

A dashboard for Laravel

568156.1k94](/packages/spatie-laravel-dashboard)[brick/schema

Schema.org library for PHP

5163.7k1](/packages/brick-schema)[ibericode/vat-bundle

Bundle for using ibericode/vat in a Symfony environment

21254.5k](/packages/ibericode-vat-bundle)[sylius/taxonomy

Taxonomies - categorization of domain models in PHP projects.

14435.6k10](/packages/sylius-taxonomy)

PHPackages © 2026

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