You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow users to hook into the request lifecycle without subclassing RestServer, e.g. for logging, metrics, auth or response decoration.
Possible events:
cache refreshed / URL map built
request received (before routing)
route resolved (controller + method known)
before / after controller call
before response is sent (allows modifying headers/body)
error occurred
Proposal
Accept an optional PSR-14Psr\EventDispatcher\EventDispatcherInterface in the constructor; no dispatcher → no events, no new hard dependency.
One small immutable event class per event (instead of string constants + generic events).
Fits well with the planned PSR-7/PSR-15 refactoring; with a middleware architecture some of these hooks might be covered by middleware instead — decide together.
A first draft based on symfony/event-dispatcher existed on the former feature/add-event-dispatcher branch (2015), which was never merged.
Activity