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

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

dazzle-php/event
================

Dazzle Events &amp; Dispatchers.

v0.4.1(8y ago)161.7k26MITPHPPHP &gt;=5.6.7

Since Sep 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dazzle-php/event)[ Packagist](https://packagist.org/packages/dazzle-php/event)[ Docs](http://kraken-php.com)[ RSS](/packages/dazzle-php-event/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (1)Versions (11)Used By (6)

Dazzle Events &amp; Dispatchers
===============================

[](#dazzle-events--dispatchers)

[![Build Status](https://camo.githubusercontent.com/4d79e7f9687ed12ecb90fb47a2f3d5c398a519d10822d4a34da6151f093b7f67/68747470733a2f2f7472617669732d63692e6f72672f64617a7a6c652d7068702f6576656e742e737667)](https://travis-ci.org/dazzle-php/event)[![Code Coverage](https://camo.githubusercontent.com/fc4daea5f97ad9017684767d8739de1cf08796d1816e35d264037a505ccdcdc3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64617a7a6c652d7068702f6576656e742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dazzle-php/event/?branch=master)[![Code Quality](https://camo.githubusercontent.com/80b0cde818ca632c22ad48ab98f763b2cd555cc2754569b502d706d4393c2dc2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64617a7a6c652d7068702f6576656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dazzle-php/event/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/7d95216420ada0fafa64f2206bd9231a6d1aab402b154451b5c9da70dbbf32aa/68747470733a2f2f706f7365722e707567782e6f72672f64617a7a6c652d7068702f6576656e742f762f737461626c65)](https://packagist.org/packages/dazzle-php/event)[![Latest Unstable Version](https://camo.githubusercontent.com/1f17b638aecaf235d771ff5df788475ec6ecaf3cac6ebe4569746ca4699de7d5/68747470733a2f2f706f7365722e707567782e6f72672f64617a7a6c652d7068702f6576656e742f762f756e737461626c65)](https://packagist.org/packages/dazzle-php/event)[![License](https://camo.githubusercontent.com/834dbd5abe98bce43a3736062d470f3e19cd2d9766375a4e895c721873a223f8/68747470733a2f2f706f7365722e707567782e6f72672f64617a7a6c652d7068702f6576656e742f6c6963656e7365)](https://packagist.org/packages/dazzle-php/event/license)

> **Note:** This repository is part of [Dazzle Project](https://github.com/dazzle-php/dazzle) - the next-gen library for PHP. The project's purpose is to provide PHP developers with a set of complete tools to build functional async applications. Please, make sure you read the attached README carefully and it is guaranteed you will be surprised how easy to use and powerful it is. In the meantime, you might want to check out the rest of our async libraries in [Dazzle repository](https://github.com/dazzle-php) for the full extent of Dazzle experience.

[![](https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/dazzle-x125.png)](https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/dazzle-x125.png)

Description
-----------

[](#description)

Dazzle Event is a library which purpose is to provide all of the tools that are required to implement event-based architecture in any application. It delivers classes and interfaces designed specifically for that exact purpose and is designed to be easy to work with, efficient and effective.

Feature Highlights
------------------

[](#feature-highlights)

Dazzle Event features:

- Support for working with events, event-dispatchers and event-handlers,
- Support for synchronous events,
- Support for asynchronous events using loop,
- Built-in event handlers,
- Built-in expanded interfaces for attaching listeners and managing events propagation,
- ...and more.

Provided Example(s)
-------------------

[](#provided-examples)

### Quickstart

[](#quickstart)

```
use Dazzle\Event\EventEmitter;

$emitter = new EventEmitter();

$emitter->on('script.start', function($user, $time) {
    echo "User '$user' has started this script at $time.\n";
});

$emitter->emit('script.start', [ get_current_user(), date('H:i:s Y-m-d') ]);
```

### Additional

[](#additional)

Additional examples can be found in [example](https://github.com/dazzle-php/event/tree/master/example) directory. Below is the list of provided examples as a reference and preferred consumption order:

- [Quickstart](https://github.com/dazzle-php/event/blob/master/example/events_quickstart.php)
- [Using multiple listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_multiple.php)
- [Using disposable (one-time) listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_disposable.php)
- [Using delayed listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_delayed.php)
- [Using exact (multiple-times) listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_exact.php)
- [Using mixed listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_mixed.php)
- [Cancelling](https://github.com/dazzle-php/event/blob/master/example/events_cancelling.php)
- [**Advanced:** Asynchronous event-emitters](https://github.com/dazzle-php/event/blob/master/example/advanced_async_emitters.php)
- [**Advanced:** Copying events](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_copying_events.php)
- [**Advanced:** Forwarding events](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_forwarding_events.php)
- [**Advanced:** Chaining events propagation](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_chaining.php)
- [**Advanced:** Switching propagation modes of event-emitters](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_switching_modes.php)

If any of the above examples has left you confused, please take a look in the [tests](https://github.com/dazzle-php/event/tree/master/test) directory as well.

Comparison
----------

[](#comparison)

This section contains Dazzle vs React comparison many users requested. If you are wondering why this section has been created, see the [author's note](https://github.com/dazzle-php/dazzle/blob/master/NOTE.md).

#### Performance

[](#performance)

[![](https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/lib/event/graph-perf-cpu.png)](https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/lib/event/graph-perf-cpu.png)

The detailed information about this benchmark can be found in [benchmark-on.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-on.php) and [benchmark-on-react.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-on-react.php) files.

#### Memory Allocation Efficiency

[](#memory-allocation-efficiency)

[![](https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/lib/event/graph-perf-mem.png)](https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/lib/event/graph-perf-mem.png)

The detailed information about this benchmark can be found in [benchmark-once.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-once.php) and [benchmark-once-react.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-once-react.php) files.

#### Details

[](#details)

DetailDazzle EventReact-equivalentActive supportX?Provided well-formed documentationXXProvided well-formed set of tests with at least 80% coverage and API examplesXXUse of events with continous listenersXXUse of events with single-use listenersXXUse of events with delayed listenersXUse of events with exact-time listenersXUse of events with mixed-type listenersXCancelling listenersXXAsynchronous emittersXCopying eventsXForwarding eventsXDifferent modes of events propagationXRequirements
------------

[](#requirements)

Dazzle Event requires:

- PHP-5.6 or PHP-7.0+,
- UNIX or Windows OS.

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

[](#installation)

To install this library make sure you have [composer](https://getcomposer.org/) installed, then run following command:

```
$> composer require dazzle-php/event

```

Tests
-----

[](#tests)

Tests can be run via:

```
$> vendor/bin/phpunit -d memory_limit=1024M

```

Versioning
----------

[](#versioning)

Versioning of Dazzle libraries is being shared between all packages included in [Dazzle Project](https://github.com/dazzle-php/dazzle). That means the releases are being made concurrently for all of them. On one hand this might lead to "empty" releases for some packages at times, but don't worry. In the end it is far much easier for contributors to maintain and -- what's the most important -- much more straight-forward for users to understand the compatibility and inter-operability of the packages.

Contributing
------------

[](#contributing)

Thank you for considering contributing to this repository!

- The contribution guide can be found in the [contribution tips](https://github.com/dazzle-php/event/blob/master/CONTRIBUTING.md).
- Open tickets can be found in [issues section](https://github.com/dazzle-php/event/issues).
- Current contributors are listed in [graphs section](https://github.com/dazzle-php/event/graphs/contributors)
- To contact the author(s) see the information attached in [composer.json](https://github.com/dazzle-php/event/blob/master/composer.json) file.

License
-------

[](#license)

Dazzle Framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

---

*"Everything is possible. The impossible just takes longer."* ― Dan Brown

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity54

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

Recently: every ~18 days

Total

10

Last Release

3224d ago

PHP version history (2 changes)v0.3.0PHP &gt;=5.5.9

0.4.x-devPHP &gt;=5.6.7

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

asyncdazzledispatchereventevent-drivenevent-emitterevent-handlerevent-handlingphpphp-libphp7eventevent-drivenemitterevent-emitterkrakenkraken-php

### Embed Badge

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

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

###  Alternatives

[league/event

Event package

1.6k141.6M184](/packages/league-event)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[contributte/event-dispatcher

Best event dispatcher / event manager / event emitter for Nette Framework

292.4M19](/packages/contributte-event-dispatcher)[pagon/eventemitter

Event Emitter for PHP

2919.3k3](/packages/pagon-eventemitter)

PHPackages © 2026

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