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

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

kovalevsky-projects/event-dispatcher
====================================

jQuery like event dispatcher for PHP

v1.0(11y ago)018MITPHPPHP &gt;=5.3.3

Since May 18Pushed 11y ago2 watchersCompare

[ Source](https://github.com/kovalevskyartur/event-dispatcher)[ Packagist](https://packagist.org/packages/kovalevsky-projects/event-dispatcher)[ RSS](/packages/kovalevsky-projects-event-dispatcher/feed)WikiDiscussions master Synced today

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

EventDispatcher
===============

[](#eventdispatcher)

Simple PHP library that allow you to dispatch events in your system.

Installation
============

[](#installation)

Install it via [Composer](https://getcomposer.org/) (`kovalevsky-projects/event-dispatcher` on [Packagist](https://packagist.org/packages/kovalevsky-projects/event-dispatcher))

Usage
=====

[](#usage)

Here's the simple example of the usage:

```
$dispatcher = new \KovalevskyProjects\EventDispatcher\EventDispatcher();

$dispatcher->on('hello.world', function() {
  echo 'Hello World!';
});

$dispatcher->trigger('hello.world');
```

Also you can use event parameters. It can be single parameter or an array of the parameters:

```
$dispatcher->on('hello.world', function($text) {
  echo $text;
});

$dispatcher->on('foo.bar', function($foo, $bar) {
  echo $foo + $bar;
});

$dispatcher->trigger('hello.world', 'Hello World!');

// You can use simple numeric arrays instead of associative
$dispatcher->trigger('foo.bar', array(
  'foo' => 2,
  'bar' => 2,
));
```

API
===

[](#api)

### Trigger

[](#trigger)

`trigger($event, $parameters = null)` - Dispatches the specified event.

You can specify single parameter or an array of parameters as second argument:

```
$dispatcher->trigger('foo.bar', 'some parameter');
// or
$dispatcher->trigger('foo.bar', [
  'one' => 'parameter one',
  'two' => 'parameter two',
]);
```

### On

[](#on)

`on($event, $action)` - Adds the action for the event.

```
$dispatcher->on('post.update', function($post, $author) {
  notify('The post ' . $post->title . ' updated by the ' . $author);
});
```

### Off

[](#off)

`off($event, $action)` - Removes the action.

```
$dispatcher->on('some.action', $callableFunction);
// ...
$dispatcher->off('some.action', $callableFunction);
```

Please note: If your are using the closures, then you can't remove the action using `Off()` method.

### Bind

[](#bind)

`bind($events, $action = null)` - Attaches the action for the more than one event.

```
$dispatcher->bind('foo bar baz', function() {
  echo 'You will see this message when foo, bar and baz events will be triggered';
});

// or with array

$dispatcher->bind(['foo', 'bar', 'baz'], function() { ... });

// or you can specify different actions for the each event

$dispatcher->bind([
  'foo' => function() { ... },
  'bar' => function() { ... },
  'baz' => function() { ... },
]);
```

### Unbind

[](#unbind)

`unbind($events = null)` - Removes all previously attached actions.

```
$dispatcher->unbind('foo bar baz');
// or
$dispatcher->unbind(['foo', 'bar', 'baz']);
// or you can remove ALL actions.
$dispatcher->unbind();
```

### Has

[](#has)

`has($event, $action = null)` - Checks whether the specified event has action.

```
$dispatcher->has('foo');
// or you can check for the specific action
$dispatcher->has('foo', $someAction);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4376d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/384ed4149d75827f45a69ed1096e89796eece67d6589b3eed9c1644787273f03?d=identicon)[kovalevskyartur](/maintainers/kovalevskyartur)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/kovalevsky-projects-event-dispatcher/health.svg)

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

###  Alternatives

[albertoarena/laravel-event-sourcing-generator

Laravel event sourcing domain generator

148.2k](/packages/albertoarena-laravel-event-sourcing-generator)

PHPackages © 2026

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