PHPackages                             celiovmjr/simpleeventstream - 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. celiovmjr/simpleeventstream

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

celiovmjr/simpleeventstream
===========================

Projeto com implementação de EventStream em PHP

0.0.2(10mo ago)086MITPHPPHP &gt;=8.3

Since Mar 17Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/celiovmjr/SimpleEventStream)[ Packagist](https://packagist.org/packages/celiovmjr/simpleeventstream)[ RSS](/packages/celiovmjr-simpleeventstream/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

SimpleEventStream
=================

[](#simpleeventstream)

The `EventStream` class enables the implementation of **Server-Sent Events (SSE)** for real-time communication between the server and the client. With this class, you can send various types of events such as error messages, notifications, progress updates, and more, using the SSE protocol.

Features
--------

[](#features)

- **Start and close the event stream**.
- **Emit custom events** like error messages, notifications, updates, and progress.
- **Simulate events** such as user joining, leaving, typing, and stopping typing.
- Full support for **Server-Sent Events** with appropriate headers.

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

[](#installation)

```
composer require celiovmjr/simpleeventstream
```

Example Usage
-------------

[](#example-usage)

Below is a basic example of how to use the `EventStream` class:

```
use SimpleEventStream\Application\EventStream;

// Create an instance of EventStream
$eventStream = new EventStream();

// Start the event stream
$eventStream->start();

// Send a notification
$eventStream->sendNotification("New event available!");

// Send a progress event
$eventStream->sendProgress(45.5);

// Send a custom update
$eventStream->sendUpdate(['status' => 'in progress']);

// Send a custom event
$eventStream->customEvent(['customData' => 'value']);

// Close the event stream
$eventStream->close();
```

Methods
-------

[](#methods)

### `start()`

[](#start)

Starts the event stream and sends a "connection opened" message.

### `emit(StreamMessage $message)`

[](#emitstreammessage-message)

Emits a message to the stream. Requires the stream to be started.

### `close()`

[](#close)

Closes the event stream and sends a "connection closed" message.

### `sendError(string $error)`

[](#senderrorstring-error)

Sends an error message to the client.

### `sendNotification(string $notification)`

[](#sendnotificationstring-notification)

Sends a custom notification to the client.

### `userJoin(string $username)`

[](#userjoinstring-username)

Simulates a user joining the system.

### `userLeave(string $username)`

[](#userleavestring-username)

Simulates a user leaving the system.

### `typing(string $username)`

[](#typingstring-username)

Simulates the typing event for a user.

### `stopTyping(string $username)`

[](#stoptypingstring-username)

Simulates the event when a user stops typing.

### `sendUpdate(array $data)`

[](#sendupdatearray-data)

Sends an update event with custom data.

### `sendProgress(float $percentage)`

[](#sendprogressfloat-percentage)

Sends a progress event with a percentage (0 to 100).

### `acknowledge(string $message)`

[](#acknowledgestring-message)

Sends an acknowledgment message to the client.

### `customEvent(array $data)`

[](#customeventarray-data)

Sends a custom event with user-provided data.

Notes
-----

[](#notes)

- The `EventStream` class uses **output buffering** in PHP, utilizing `ob_implicit_flush()` and `ob_end_flush()` to ensure data is sent to the client in real-time.
- Communication is done through the **Server-Sent Events (SSE)** protocol, which is one-way and ideal for sending continuous updates from the server to the client.
- Ensure your web server is configured to support SSE.

License
-------

[](#license)

This project is licensed under the MIT License. See the LICENSE file for more details.

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance61

Regular maintenance activity

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Every ~115 days

Total

2

Last Release

302d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0277186b718fe518349a01fb7b34ad6eb0d67ef64801cb6a9eca3e4f8df77f67?d=identicon)[celiovmjr](/maintainers/celiovmjr)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/celiovmjr-simpleeventstream/health.svg)

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

###  Alternatives

[kaufmanndigital/gdpr-cookieconsent

A ready-to-run package, that integrates an advanced cookie consent banner into your Neos CMS site.

2540.7k](/packages/kaufmanndigital-gdpr-cookieconsent)[selective/transformer

A strictly typed array transformer with dot-access, fluent interface and filters.

3817.8k1](/packages/selective-transformer)[derhansen/sf_banners

Banner-Management Extension based on Extbase and Fluid. Loads banners asynchronously using JavaScript.

1144.5k](/packages/derhansen-sf-banners)[martin/wn-forms-plugin

Create easy (and almost magic) AJAX forms

212.3k](/packages/martin-wn-forms-plugin)

PHPackages © 2026

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