PSR-14: A major PHP Event
summary
Standardizes event dispatching around three interfaces — EventDispatcher, ListenerProvider and optional StoppableEvent — and ships a reference implementation called sucio. Providers map events to callables (type-based, priority, compiled or delegating) while dispatchers only invoke listeners, enabling mix-and-match across frameworks; Symfony 4.3 and Laminas/Typo3/Yii integrations exist. Examples include a voter-style access-control event object (allow/deny and built-in stop logic), compiled provider performance paths, and deferred listeners queued via AMQP requiring serializable events.
AI-written summary · about
chapters (35)
- 0:00Introduction
- 0:42What is an event
- 1:46Direct observer vs mediated observer
- 3:15Event Dispatcher
- 6:38Which one should you use
- 7:41PHP Figma Framework Interoperability Group
- 8:58Goals for PSR14
- 10:35Use Cases
- 13:11The Spec
- 14:15How to use it
- 15:25Basic dispatcher
- 16:47Providers
- 18:52Listener Providers
- 19:46Sucio
- 21:10Register Services
- 21:31Subscriber Classes
- 22:29Compiled Containers
- 23:19Cart
- 24:00Frameworks
- 25:06Modulating an Event
- 26:09Access Control
- 26:53The Event
- 29:09Access Check
- 30:36Custom Provider
- 31:45Aggregate Provider
- 32:24Delegate Provider
- 33:12Default Provider
- 34:19Deferred Events
- 37:22Register the Listener
- 38:01Service Listener
- 38:40Lazy Listener
- 39:51Get Listener
- 40:18Queue Runner
- 41:13Summary
- 42:45Further reading
related talks
47mDon't get hooked, listen to events! PSR-14 within TYPO3 v10
46mPSR-18: Abstracting HTTP clients in PHP
52mPSR 7 HTTP Messages In the Wild
38mPHP FIG: Helping communities work together
45mServer-Sent Events
43mAdding Event Sourcing to an existing PHP project (for the right reasons)
02h 53mPractical design patterns in PHP (Part 3)
45mPHP Reactive Programming
