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

ActiveLibrary

slick/event
===========

Simple PSR-14 event handling implementation.

v1.2.0(5mo ago)01.7k↑50%2MITPHPPHP &gt;=8.3CI passing

Since Apr 27Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/slickframework/event)[ Packagist](https://packagist.org/packages/slick/event)[ Docs](https://github.com/slickframework/event)[ RSS](/packages/slick-event/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (6)Used By (2)

Slick Event
===========

[](#slick-event)

[![Latest Version](https://camo.githubusercontent.com/899f40056c80b06e8e3801ab5d6d041c9e7fac5e7fe75e6694d3f5272b7ab668/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736c69636b6672616d65776f726b2f6576656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/slickframework/event/releases)[![License: MIT](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![CI Status](https://camo.githubusercontent.com/f7d041643498e6e6d145212f8bcaf247a2a3a95076f71b09bc73d215ca7dcba9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736c69636b6672616d65776f726b2f6576656e742f636f6e74696e756f75732d696e746567726174696f6e2e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/slickframework/event/actions/workflows/continuous-integration.yml)[![Quality Score](https://camo.githubusercontent.com/5d7fa150ecfa52332b6729b26699e396698df916d04b0be3c8224fdb7c289df1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f736c69636b6672616d65776f726b2f6576656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/slickframework/event/)[![Downloads](https://camo.githubusercontent.com/0bd1e72ed1a4d828cc75edb62448ea86e556242181eb8c9ccca4eb02d21b2860/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736c69636b2f6576656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/slick/event)

**Slick Event** is a modern and lightweight PHP library that provides a clean, flexible, and PSR-14-compliant event dispatching system. Built for developers who value simplicity, testability, and performance, it allows you to decouple your application logic using event-driven architecture without the overhead of heavier frameworks.

Whether you're working with a microservice, a modular monolith, or a full-stack application, Slick Event integrates seamlessly and gives you the tools to manage domain events, listeners, and dispatchers with ease.

---

### ✨ Features

[](#-features)

- ✅ **PSR-14 compliant**: Follows the PHP-FIG Event Dispatcher standard for interoperability.
- 🔁 **Synchronous event dispatching** with support for multiple listeners.
- ⚙️ **Simple and intuitive API** for registering and dispatching events.
- 🧪 **Spec-driven development** using PHPSpec ensures reliability and clean design.
- 🧩 **Framework-agnostic**: Use it in any PHP project, regardless of framework.

This package follows:

- [PSR-2: Coding Style Guide](https://www.php-fig.org/psr/psr-2/)
- [PSR-4: Autoloading Standard](https://www.php-fig.org/psr/psr-4/)
- [Semantic Versioning 2.0.0](https://semver.org)

---

🚀 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require slick/event
```

---

🧩 Basic Usage
-------------

[](#-basic-usage)

```
use Slick\Event\EventDispatcher;
use Slick\Event\Event;

$dispatcher = new EventDispatcher();

$dispatcher->listen(SomeEvent::class, function (SomeEvent $event) {
    // Handle event
});

// Dispatch event
$dispatcher->dispatch(new SomeEvent());
```

---

✅ Usage
-------

[](#-usage)

### 1. Define an Event and a Listener

[](#1-define-an-event-and-a-listener)

```
namespace App\Domain\Event;

final class UserWasRegistered
{
    public function __construct(public string $email) {}
}
```

```
namespace App\Application\Listener;

use App\Domain\Event\UserWasRegistered;
use Slick\Event\Application\Attribute\AsEventListener;

#[AsEventListener(event: UserWasRegistered::class)]
final class SendWelcomeEmail
{
    public function __invoke(UserWasRegistered $event): void
    {
        // Send welcome email to $event->email
    }
}
```

---

### 2. Set Up the ListenerProvider and Dispatcher

[](#2-set-up-the-listenerprovider-and-dispatcher)

```
use Slick\Event\Infrastructure\AttributeListenerResolver;
use Slick\Event\Infrastructure\AttributeListenerProvider;
use Slick\Event\EventDispatcher;
use App\YourContainer;

$container = new YourContainer(); // PSR-11 compliant

$resolver = new AttributeListenerResolver(
    __DIR__.'/src/Application/Listener',
    $container
);

$provider = new AttributeListenerProvider($resolver);
$dispatcher = new EventDispatcher($provider);
```

---

### 3. Dispatch the Event

[](#3-dispatch-the-event)

```
$dispatcher->dispatch(new UserWasRegistered('user@example.com'));
```

All listeners discovered via `#[AsEventListener]` will be automatically executed.

---

✅ Testing
---------

[](#-testing)

We use [PHPSpec](http://www.phpspec.net/) for unit testing.

Run tests with:

```
vendor/bin/phpspec run
```

or

```
composer test
```

---

🤝 Contributing
--------------

[](#-contributing)

Please read our [CONTRIBUTING.md](CONTRIBUTING.md) guidelines.

---

🛡 Security
----------

[](#-security)

If you discover a security vulnerability, please email us at **** instead of using the issue tracker.

---

🙏 Credits
---------

[](#-credits)

- [Slick Framework Team](https://github.com/slickframework)
- [All Contributors](https://github.com/slickframework/event/graphs/contributors)

---

📄 License
---------

[](#-license)

This package is open-source software licensed under the [MIT License](LICENSE).

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance76

Regular maintenance activity

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity74

Established project with proven stability

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

Total

4

Last Release

165d ago

PHP version history (3 changes)v1.0.0PHP &gt;=7.2

v1.1.0PHP &gt;=8.2

v1.2.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/85bd1fa7a4f7351fdd6fd799684e9adf215c57d26512e9b212a8dd89aca8de1f?d=identicon)[fsilva](/maintainers/fsilva)

---

Top Contributors

[![silvamfilipe](https://avatars.githubusercontent.com/u/5720969?v=4)](https://github.com/silvamfilipe "silvamfilipe (22 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

31.3k86.3M2.2k](/packages/symfony-symfony)[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M341](/packages/drupal-core-recommended)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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