PHPackages                             core-framework/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. [Framework](/categories/framework)
4. /
5. core-framework/dispatcher

AbandonedLibrary[Framework](/categories/framework)

core-framework/dispatcher
=========================

CoreFramework Event Dispatcher Component

v1.0.0(8y ago)05MITPHPPHP ^7.1.3

Since Dec 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/core-framework/dispatcher)[ Packagist](https://packagist.org/packages/core-framework/dispatcher)[ RSS](/packages/core-framework-dispatcher/feed)WikiDiscussions master Synced 3d ago

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

Dispatcher Component
====================

[](#dispatcher-component)

The Dispatcher component provides means by which your applications components can communicate with each other by using the Publish/Subscribe model.

Usage
-----

[](#usage)

#### 1. Basic usage:

[](#1-basic-usage)

First create a Dispatcher Instance:

```
$dispatcher = new Dispatcher();
```

Then subscribe to events using the following syntax:

```
$dispatcher->on('eventFoo', function() { echo 'foo';});
```

The second parameter for the `on()` method can be `callable` like a **Closure** (*anonymous functions*) or can be instances of `Core\Events\ListenerInterface`.

An Example of listener Class can be as follows:

```
class TestEventListener implements ListenerInterface
{
    /**
     * @var EventInterface
     */
    public $calledEvent;
    /**
     * @var string
     */
    public $eventName;
    /**
     * @var DispatcherInterface
     */
    public $dispatcher;

    public function __invoke(EventInterface $event, string $eventName = null, DispatcherInterface $dispatcher = null)
    {
        $this->calledEvent = $event;
        $this->eventName = $eventName;
        $this->dispatcher = $dispatcher;
    }
}
```

The `Listener` Class you define must implement the [`ListenerInterface`](src/Core/Events/ListenerInterface.php) which mandates the definition of the `invoke()` method.

#### 2. Event Subscribers:

[](#2-event-subscribers)

The `Dispatcher` class provides for means to add Subscribers that can add their own set of event listeners. You can add Subscribers using the `addSubscriber()` method as follows:

```
$subscriber = new Subscriber();
$dispatcher->addSubscriber($subscriber);
```

The defined `Subscriber` class must implement the [`SubscriberInterface`](src/Core/Events/SubscriberInterface.php).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

3083d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66afad271e576e1faa46da4b4752ecd3e3f3a522d3b3ab46e4ed09c96ddcc647?d=identicon)[shalomsam](/maintainers/shalomsam)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/core-framework-dispatcher/health.svg)

```
[![Health](https://phpackages.com/badges/core-framework-dispatcher/health.svg)](https://phpackages.com/packages/core-framework-dispatcher)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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