Event Handling
Event CQRS PHP
Handling Events
class TicketService
{
#[EventHandler]
public function when(TicketWasCreated $event): void
{
// handle event
}
}class readonly TicketWasCreated
{
public function __construct(
public string $ticketId
) {}
}Publishing Events
Multiple Subscriptions
Subscribe to Interface or Abstract Class
Subscribing by Union Classes
Subscribing to All Events
Subscribing to Events by Routing
Subscribing to Events by Routing and Class Name
Sending Events with Metadata
Metadata Propagation
Last updated
Was this helpful?