stougeiro/event-contract

Minimal event contract defining lightweight interfaces for dispatching string-based events and registering listeners in modular PHP applications.

Maintainers

Package info

github.com/stougeiro/event-contract

pkg:composer/stougeiro/event-contract

Transparency log

Fund package maintenance!

Buymeacoffee

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-19 19:34 UTC

This package is auto-updated.

Last update: 2026-08-19 19:37:14 UTC


README

phpstan-level

Event Contract

Minimal event contract package defining the core interfaces for a plug-and-play event system. Provides a lightweight EventManagerInterface for dispatching string‑based events and registering listeners, along with a simple EventListenerInterface for building modular, high‑performance PHP applications.

✨ Features

  • Lightweight event dispatcher
    Dispatches string-based events with zero overhead and no required event classes.

  • Simple listener model
    Listeners are invokable classes, allowing full freedom for dependency injection.

  • Plug-and-play architecture
    Any event implementation can be swapped without changing application code.

  • Framework-agnostic
    Works with any PHP project, from microframeworks to full-stack applications.

  • High performance
    Minimal abstractions designed for fast execution, ideal for shared hosting environments.

📦 Installation

Install via Composer:

composer require stougeiro/event-contract

🔧 Implementations

Below is a list of known implementations maintained by the community.

🧠 Why?

Because event systems don’t need to be complex. This contract defines the smallest possible interface for an event dispatcher, enabling developers to build fast, modular applications without the overhead of class‑based events or heavy abstractions.

By using simple string identifiers and invokable listeners, any event engine can be implemented — synchronous, asynchronous, queued, file‑based, or custom — while keeping a consistent interface across the entire application.

This promotes flexibility, testability, and high performance, especially in environments with limited resources.

🤝 Contributions

Contributions are welcome. Feel free to open issues or submit pull requests.