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

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

aatis/event-dispatcher
======================

Event dispatcher of Aatis

1.1.0(9mo ago)0391PHPPHP &gt;=8.2

Since Feb 10Pushed 8mo ago1 watchersCompare

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

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

Aatis ED
========

[](#aatis-ed)

Advertisement
-------------

[](#advertisement)

This package is a part of `Aatis` and can't be used without the following packages :

- `aatis/dependency-injection` ()
- `aatis/tag` ()

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

[](#installation)

```
composer require aatis/event-dispatcher
```

Usage
-----

[](#usage)

### Requirements

[](#requirements)

Add the `EventDispatcher` service to the `Container`:

```
# In config/services.yaml file :

include_services:
    - 'Aatis\EventDispatcher\Service\EventDispatcher'
```

### Event

[](#event)

This package provides an abstract `Event` class that can be extended to create custom events like the following :

```
use Aatis\EventDispatcher\Event\Event;

class ExampleEvent extends Event
{
}
```

### StoppableEvent

[](#stoppableevent)

This package provides also an abstract `StoppableEvent` class that can be extended to create custom stoppable events like the following :

```
use Aatis\EventDispatcher\Event\StoppableEvent;

class ExampleStoppableEvent extends StoppableEvent
{
}
```

This class implements a custom `StoppableEventInterface` that extends the `Psr\EventDispatcher\StoppableEventInterface`.

So, with this class, you can access 2 specific methods :

- `isPropagationStopped` that returns a boolean to know if the event propagation is stopped
- `stopPropagation` that set the propagation to `false`, it must be called into a listener or a subscriber method

### Priority

[](#priority)

The `EventDispatcher` service can dispatch events with a priority amount that is an integer. The higher the priority, the earlier the event will be dispatched.

If two listeners have the same priority for the same event, the order of execution is for this two listeners is random.

By default, the priority is set to `0`.

### EventListener

[](#eventlistener)

A listener is a class that can be called when an event is dispatched. It must contains a `__invoke` method with only one parameter that must be the event listened.

Example of a listener targeting the `ExampleEvent` :

```
class ExampleListener
{
    public function __invoke(ExampleEvent $event): void
    {
        // Do something
    }
}
```

You can specify the priority of a listener by attaching a `EventListener` attribute to the class with a `priority` parameter :

```
#[EventListener(priority: 2)]
class ExampleListener
{
    public function __invoke(ExampleEvent $event): void
    {
        // Do something
    }
}
```

Finally, you must inform the container that this class is a listener by adding the `event-listener` tag to the service :

```
# In config/services.yaml file :

services:
    App\Listener\ExampleListener:
        tags:
            - 'event-listener'
```

### EventSubscriber

[](#eventsubscriber)

A subscriber is a class that contains multiple listener methods and subscibe to several events.

It must provide a `getSubscribedEvents` method that returns the array of the events to which the service subscribes and their associated listener method.

Example of a subscriber :

```
class TestSubscriber implements EventSubscriberInterface
{
    public function onExample(Event $event): void
    {
        // Do something
    }

    public function onExampleBis(Event $event): void
    {
        // Do something
    }

    public function getSubscribedEvents(): iterable
    {
        return [
            ExampleEvent::class => 'onExample',
            ExampleBisEvent::class => 'onExampleBis',
        ];
    }
}
```

You can also specify multiple listeners for the same event by passing an array instead :

```
public function getSubscribedEvents(): iterable
{
    return [
        ExampleEvent::class => [
            'onExample',
            'onExampleBis'
        ],
        ExampleBisEvent::class => 'onExampleBis',
    ];
}
```

For the priority, you can also pass an array with the listener method and the priority as an integer :

```
public function getSubscribedEvents(): iterable
{
    return [
        ExampleEvent::class => [
            ['onExample', 2],
            'onExampleBis'
        ],
        ExampleBisEvent::class => ['onExampleBis', 2],
    ];
}
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance59

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

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

Every ~270 days

Total

3

Last Release

279d ago

Major Versions

0.0.0 → 1.0.02024-02-14

PHP version history (2 changes)0.0.0PHP ^8.2

1.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f62599db29152e0adf71ca1df468470b4d572bc556a4a634dc6c016157a5044?d=identicon)[Aatis](/maintainers/Aatis)

---

Top Contributors

[![BatMaxou](https://avatars.githubusercontent.com/u/90443919?v=4)](https://github.com/BatMaxou "BatMaxou (5 commits)")

### Embed Badge

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

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

###  Alternatives

[symfony/event-dispatcher-contracts

Generic abstractions related to dispatching event

3.4k756.5M424](/packages/symfony-event-dispatcher-contracts)[league/event

Event package

1.6k141.6M184](/packages/league-event)[phpro/soap-client

A general purpose SoapClient library

8885.6M46](/packages/phpro-soap-client)[yohang/finite

A simple PHP Finite State Machine

1.3k3.5M10](/packages/yohang-finite)[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.4k423.9k30](/packages/mcp-sdk)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)

PHPackages © 2026

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