System Events Package Overview
The DomainFlow System Events package provides a robust framework for capturing and processing system events within your application. It enables efficient event logging and handling, facilitating better observability and debugging.
Key Features
-
Event Processing Interface: Defines a contract (
SystemEventProcessorInterface) for writing system events to various destinations, such as files or external services. -
Flexible Event Listening: Implements a listener (
SystemEventListener) that can catch specific events or all events using wildcards, allowing for comprehensive event monitoring. -
File-Based Event Logging: Includes a file system processor (
FileSystemEventProcessor) that logs events to a specified file with customizable templates and placeholders. -
Fan-Out to Multiple Destinations:
CompositeSystemEventProcessorforwards a single event to several configured processors at once (e.g. a file destination plus a future Redis/DB destination), so every destination still receives the event even if an earlier one fails. -
Event Name / Namespace Filtering: An optional
SystemEventFilterInterface, with the built-in glob-basedEventNamePatternFilter, restricts which event names are actually processed — useful when you only want to capture a subset of your application's events (e.g.payment.*). -
Processor-Failure Isolation: A failing processor never propagates its exception into the code that fired the original event — failures are reported via
error_log()by default, or a custom hook you provide. -
Service Provider Integration: Offers a service provider (
SystemEventsServiceProvider) to register event processors and listeners seamlessly within the DomainFlow application lifecycle.
The DomainFlow System Events package offers a flexible and extensible solution for event logging and processing within your application, enhancing observability and facilitating effective debugging.
👉 See Installation and Usage for more details. For advanced topics, see Processor-Failure Handling, Event Filtering, and Fan-Out Processing.