PHPackages                             lithemod/events - 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. lithemod/events

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

lithemod/events
===============

Lithe Events: A powerful and lightweight event management system for PHP projects, designed to simplify communication between components intuitively and efficiently. Easily create, register, and emit events, making your code more modular and reactive. Transform your applications into dynamic experiences with Lithe Events!

v1.1.0(1y ago)014MITPHP

Since Oct 20Pushed 1y agoCompare

[ Source](https://github.com/lithemod/events)[ Packagist](https://packagist.org/packages/lithemod/events)[ RSS](/packages/lithemod-events/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Lithe Events
============

[](#lithe-events)

Lithe Events is a lightweight event handling library designed for PHP applications. It provides a straightforward way to create and manage events, supporting a decoupled architecture that enhances the maintainability and flexibility of your applications.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Using the EventDispatcher Class](#using-the-eventdispatcher-class)
        - [Creating an Event](#creating-an-event)
        - [Registering Listeners](#registering-listeners)
        - [Emitting Events](#emitting-events)
        - [Removing Listeners](#removing-listeners)
    - [Using Orbis Event Functions](#using-orbis-event-functions)
- [Example](#example)
- [License](#license)

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

[](#installation)

To install `lithemod/events`, use Composer. Run the following command in your project directory:

```
composer require lithemod/events
```

This command will download the package and update your `composer.json` file accordingly.

Usage
-----

[](#usage)

### Using the EventDispatcher Class

[](#using-the-eventdispatcher-class)

The `EventDispatcher` class serves as the core for managing events and listeners. Here's how to use it effectively:

#### Creating an Event

[](#creating-an-event)

To create an event, instantiate the `Event` class:

```
use Lithe\Events\Event;

$event = new Event('event.name', ['key' => 'value']);
```

- **Parameters**:
    - `event.name`: A string that identifies the event.
    - `['key' => 'value']`: An optional associative array to store additional event data.

#### Registering Listeners

[](#registering-listeners)

You can create an instance of `EventDispatcher` and register a listener for an event using the `on` method. A listener is a callable executed when the event is emitted.

```
use Lithe\Events\EventDispatcher;

$dispatcher = new EventDispatcher();

$listener = function ($data) {
    echo "Event data: " . json_encode($data);
};

// Register the listener
$dispatcher->on('event.name', $listener);
```

#### Emitting Events

[](#emitting-events)

To emit an event and trigger all registered listeners, use the `emit` method:

```
$event = new Event('event.name', ['key' => 'value']);
$dispatcher->emit($event);
```

#### Removing Listeners

[](#removing-listeners)

If you need to remove a listener from an event, use the `off` method:

```
$dispatcher->off('event.name', $listener);
```

### Using Orbis Event Functions

[](#using-orbis-event-functions)

In addition to using the `EventDispatcher`, you can utilize helper functions provided by the `Orbis` namespace for convenient event management.

#### Registering Listeners

[](#registering-listeners-1)

To register a listener for an event using Orbis, use the `on` function:

```
use Lithe\Orbis\Events;

$listener = function ($data) {
    echo "Event data: " . json_encode($data);
};

// Register the listener
Events\on('event.name', $listener);
```

#### Emitting Events

[](#emitting-events-1)

To emit an event using Orbis, call the `emit` function:

```
use Lithe\Orbis\Events;
use Lithe\Events\Event;

$event = new Event('event.name', ['key' => 'value']);
Events\emit($event);
```

#### Removing Listeners

[](#removing-listeners-1)

To remove a registered listener with Orbis, use the `off` function:

```
Events\off('event.name', $listener);
```

Example
-------

[](#example)

Here's a complete example of how to use `lithemod/events` with the `Orbis` event functions:

```
use Lithe\Events\Event;
use Lithe\Orbis\Events;

// Create a listener
$listener = function ($data) {
    echo "Event received with data: " . json_encode($data) . "\n";
};

// Register the listener
Events\on('my.event', $listener);

// Emit the event
$data = ['msg' => 'Hello, world!'];
Events\emit(new Event('my.event', $data));

// Remove the listener
Events\off('my.event', $listener);
```

License
-------

[](#license)

This project is licensed under the [MIT License](LICENSE).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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 ~20 days

Total

2

Last Release

555d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/56173de3a7bf7099dd8168efd730d3c2fb5df5174a123fdc37cee8c3589e2345?d=identicon)[williamhumbwavali](/maintainers/williamhumbwavali)

---

Top Contributors

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

---

Tags

eventslibrarymodulephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lithemod-events/health.svg)

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

PHPackages © 2026

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