Download the PHP package milpa/events without Composer
On this page you can find all versions of the php package milpa/events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package events
# Milpa Events
> The **reference event dispatcher** for the Milpa PHP framework, built on **`milpa/core`**. String-named events with dot-segment wildcard subscriptions (`user.*`), priority ordering, per-listener error isolation, and a pluggable async (queue) seam — the concrete implementation of the `MilpaEventDispatcherInterface` contract `milpa/core` defines.
[](https://github.com/getmilpa/events/actions/workflows/ci.yml)
[](https://packagist.org/packages/milpa/events)
[](https://www.php.net/)
[](LICENSE)
[](https://getmilpa.github.io/events/)
`milpa/events` is where `milpa/core`'s event-dispatch seam becomes a working engine.
`Milpa\Interfaces\Event\MilpaEventDispatcherInterface` is a contract defined in core; this
package is the concrete `EventDispatcher` — plugins publish and subscribe to string-named
events (`'user.created'`, `'order.shipped'`) without depending on each other directly.
**No Doctrine, no HTTP kernel, no concrete queue** — the async seam is a plain callable you
wire in; the queue itself lives in your host application.
## Install
## Quick example
Subscribe by exact name or by a dot-segment wildcard, dispatch, and let priority decide the
call order — higher priority runs first:
A handler that throws is logged and does **not** stop the remaining handlers — one bad
listener never aborts a dispatch:
## Wildcard grammar
Event names are dot-separated segments; `*` matches exactly **one** segment — it never spans
a `.`. Matching is case-sensitive and anchored (the whole name must match):
| Pattern | Matches | Does not match |
|---|---|---|
| `user.*` | `user.created`, `user.deleted` | `user.profile.updated` (two segments after `user.`) |
| `*.created` | `user.created`, `order.created` | `user.createdX` (anchored, not a substring match) |
| `*` | `boot`, `ready` (single-segment names) | `user.created` (dotted) |
## Async: a seam, not an implementation
`dispatch($event, $payload, async: true)` requests deferred execution. **This package ships
no queue** — you wire one in with `setAsyncDispatcher()`:
Without a dispatcher wired, `async: true` **degrades to synchronous dispatch** (subscribers
run inline, in the same call) rather than silently dropping the event — a conformant
fallback per the interface's documented `$async` contract, not a bug. Both branches are
covered in `tests/EventDispatcherTest.php`.
## Why the namespace is `Milpa\Eventing`
`milpa/core` already owns `Milpa\Events\` for its event *objects*
(`VerificationRequestedEvent` and friends, under `src/Events/`). A package literally named
`milpa/events` colliding with that namespace would either clash or force an awkward split.
`Milpa\EventDispatcher\EventDispatcher` was the other candidate and stutters. `Milpa\Eventing`
avoids both: no collision, no stutter, and it names the *mechanism* (dispatch, subscribe,
wildcards, priority) distinctly from `Milpa\Events`, which names the *event objects* — the
two packages' responsibilities stay visibly distinct. This follows the family-wide rule:
namespace semantically correct beats cosmetic symmetry with the package name.
## What lives where
| Layer | Package | Owns |
|-------|---------|------|
| Contracts | `milpa/core` | `MilpaEventDispatcherInterface`, `EventSubscriberInterface` — the seam, not the engine. |
| **Dispatcher** | **`milpa/events`** (this package) | The concrete `EventDispatcher`: exact + wildcard subscriber matching, priority ordering, listener error isolation, and the async seam. |
| Your app | your host / plugins | The queue `setAsyncDispatcher()` hands events to, and any PSR-3 logger you pass in. |
## Requirements
- PHP **≥ 8.3**
- [`milpa/core`](https://packagist.org/packages/milpa/core) **^0.6**
- [`psr/log`](https://packagist.org/packages/psr/log) **^3**
## Documentation
**Full API reference: [getmilpa.github.io/events](https://getmilpa.github.io/events/)** — generated
straight from the source DocBlocks and dressed with the Milpa design system.
## Contributing
Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Please report security
issues via [SECURITY.md](SECURITY.md), and note that this project follows a
[Code of Conduct](CODE_OF_CONDUCT.md).
## License
[Apache-2.0](LICENSE) © Rodrigo Vicente - TeamX Agency.
---
Milpa is designed, built, and maintained by **[Rodrigo Vicente - TeamX Agency](https://teamx.agency/?utm_source=github&utm_medium=readme&utm_campaign=milpa&utm_content=events)**.
All versions of events with dependencies
PHP Build Version
Package Version
The package milpa/events contains the following files
Loading the files please wait ...