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(3mo ago)01.7k↑50%MITPHPPHP &gt;=8.3CI passing

Since Apr 27Pushed 3mo 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 today

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

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

49

—

FairBetter than 95% of packages

Maintenance78

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

116d 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

[spiral/framework

Spiral, High-Performance PHP/Go Framework

2.0k1.6M53](/packages/spiral-framework)[patchlevel/event-sourcing

A lightweight but also all-inclusive event sourcing library with a focus on developer experience

198256.8k5](/packages/patchlevel-event-sourcing)[mix/mix

PHP CLI mode development framework

1.9k1.2k](/packages/mix-mix)[hyperf/database

A flexible database library.

192.7M206](/packages/hyperf-database)[wpstarter/framework

The WpStarter Framework - Laravel Framework for WordPress

1610.0k4](/packages/wpstarter-framework)[heptacom/heptaconnect-framework

HEPTAconnect framework package that contains all core and base packages for a HEPTAconnect project

111.7k](/packages/heptacom-heptaconnect-framework)

PHPackages © 2026

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