PHPackages                             fyre/event - 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. fyre/event

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

fyre/event
==========

An event library.

v5.0.3(8mo ago)01367MITPHP

Since Oct 26Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/elusivecodes/FyreEvent)[ Packagist](https://packagist.org/packages/fyre/event)[ RSS](/packages/fyre-event/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (4)Versions (30)Used By (7)

FyreEvent
=========

[](#fyreevent)

**FyreEvent** is a free, open-source events library for *PHP*.

Table Of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)
- [Events](#events)
- [Event Listeners](#event-listeners)
- [Event Dispatchers](#event-dispatchers)

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

[](#installation)

**Using Composer**

```
composer require fyre/event

```

In PHP:

```
use Fyre\Event\EventManager;
```

Basic Usage
-----------

[](#basic-usage)

- `$parentEventManager` is an *EventManager* that will handle propagated events, and will default to *null*.

```
$eventManager = new EventManager($parentEventManager);
```

Methods
-------

[](#methods)

**Add Listener**

Add an [*EventListener*](#event-listeners).

- `$eventListener` is an [*EventListener*](#event-listeners).

```
$eventManager->addListener($eventListener);
```

**Clear**

Clear all events.

```
$eventManager->clear();
```

**Dispatch**

Dispatch an [*Event*](#events).

- `$event` is an [*Event*](#events).

```
$eventManager->dispatch($event);
```

**Has**

Check if an event exists.

- `$name` is a string representing the event name.

```
$hasEvent = $eventManager->has($name);
```

**Off**

Remove event(s).

- `$name` is a string representing the event name.
- `$callback` is the callback to remove.

```
$eventManager->off($name, $callback);
```

If the `$callback` argument is omitted, all events will be removed instead.

```
$eventManager->off($name);
```

**On**

Add an event.

- `$name` is a string representing the event name.
- `$callback` is the callback to execute.
- `$priority` is a number representing the callback priority, and will default to *EventManager::PRIORITY\_NORMAL*.

```
$eventManager->on($name, $callback, $priority);
```

**Remove Listener**

Remove an [*EventListener*](#event-listeners).

- `$eventListener` is an [*EventListener*](#event-listeners).

```
$eventManager->removeListener($eventListener);
```

**Trigger**

Trigger an event.

- `$name` is a string representing the event name.

Any additional arguments supplied will be passed to the event callback.

```
$event = $eventManager->trigger($name, ...$args);
```

Events
------

[](#events)

```
use Fyre\Event\Event;
```

- `$name` is a string representing the name of the *Event* .
- `$subject` is an object representing the *Event* subject, and will default to *null*.
- `$data` is an array containing the *Event* data, and will default to *\[\]*.
- `$cancelable` is a boolean indicating whether the event can be cancelled, and will default to *true*.

```
$event = new Event($name, $subject, $data, $cancelable);
```

**Get Data**

Get the *Event* data.

```
$data = $event->getData();
```

**Get Name**

Get the *Event* name.

```
$name = $event->getName();
```

**Get Result**

Get the *Event* result.

```
$result = $event->getResult();
```

**Get Subject**

Get the *Event* subject.

```
$subject = $event->getSubject();
```

**Is Default Prevented**

Determine whether the default *Event* should occur.

```
$isDefaultPrevented = $event->isDefaultPrevented();
```

**Is Propagation Stopped**

Determine whether the *Event* propagation was stopped.

```
$isPropagationStopped = $event->isPropagationStopped();
```

**Prevent Default**

Prevent the default *Event*.

```
$event->preventDefault();
```

**Set Data**

- `$data` is an array containing the *Event* data.

```
$event->setData($data);
```

**Set Result**

- `$result` is the *Event* result.

```
$event->setResult($result);
```

**Stop Propagation**

Stop the *Event* propagating.

```
$event->stopPropagation();
```

Event Listeners
---------------

[](#event-listeners)

Custom event listeners can be created by implementing the `Fyre\Event\EventListenerInterface`, ensuring all below methods are implemented.

```
use Fyre\Event\EventListenerInterface;

class MyListener implements EventListenerInterface
{

}
```

**Implemented Events**

Get the implemented events.

```
$events = $listener->implementedEvents();
```

Event Dispatchers
-----------------

[](#event-dispatchers)

Custom event dispatchers can be created by using the `Fyre\Event\EventDispatcherTrait`.

```
use Fyre\Event\EventDispatcherTrait;

class MyDispatcher
{
    use EventDispatcherTrait;
}
```

**Dispatch Event**

Dispatch an [*Event*](#events).

- `$name` is a string representing the event name.
- `$data` is an array containing the *Event* data, and will default to *\[\]*.
- `$subject` is an object representing the *Event* subject, and will default to the event dispatcher.
- `$cancelable` is a boolean indicating whether the event can be cancelled, and will default to *true*.

```
$this->dispatchEvent($name, $data, $subject, $cancelable);
```

**Get Event Manager**

Get the *EventManager*.

```
$eventManager = $this->getEventManager();
```

**Set Event Manager**

Set the *EventManager*.

- `$eventManager` is an *EventManager*.

```
$this->setEventManager($eventManager);
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance61

Regular maintenance activity

Popularity10

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Recently: every ~21 days

Total

29

Last Release

244d ago

Major Versions

v1.0.7 → v2.02023-07-16

v2.0.9 → v3.02024-11-17

v3.0 → v4.02024-12-24

v4.1.4 → v5.02025-10-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/fad81fd5941e3a637c8a5749d05ae3ed9314d5e2fee57f59c3d9ec3b41259c6b?d=identicon)[elusivecodes](/maintainers/elusivecodes)

---

Top Contributors

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

---

Tags

eventsphp

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fyre-event/health.svg)

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

###  Alternatives

[kirschbaum-development/nova-comments

A Laravel Nova resource for commenting on model.

32128.6k](/packages/kirschbaum-development-nova-comments)[pirsch-analytics/laravel-pirsch

Official Laravel integration for Pirsch Analytics.

4852.6k2](/packages/pirsch-analytics-laravel-pirsch)[shopsys/coding-standards

Coding standards definition compatible with PSR-2

20276.8k20](/packages/shopsys-coding-standards)[oveleon/contao-component-style-manager

Style and CSS-Class Manager for Contao Open Source CMS

2337.6k8](/packages/oveleon-contao-component-style-manager)

PHPackages © 2026

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