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

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

dhenfie/event-dispatcher
========================

Simple PHP Event Dispatcher

1.0.0(2y ago)06MITPHP

Since Sep 25Pushed 2y ago1 watchersCompare

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

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

About
-----

[](#about)

This is a simple event dispatcher for PHP. It allows components of an application to communicate with each other through events without having to know anything about each other.

Install
-------

[](#install)

```
composer require dhenfie/event-dispatcher
```

Usage
-----

[](#usage)

### \# Register Listeners

[](#-register-listeners)

A listener is something that listens to events and does something when the event occurs. To register a listener, use the `EventDispatcher::listen($eventName, $listener)` method.

A listener is a class that implements the `EventListenerInterface` interface.

Here is an example class as an event listener:

```
