Until TYPO3 9 LTS, we were using Extbase’s SignalSlot and TYPO3 custom hook system for extending the core in accordance with our implementation requirements. TYPO3 10 LTS implemented PSR 14, which is the standardized way for dispatching events. Before getting into the details of how this event dispatcher is used in TYPO3, let us have a look into PSR-14.
What is PSR-14 and what is it used for?
Whenever a piece of code hits a hook or signal, the third-party extension can register some sort of listener and alter, enhance, add to or simply observe (e.g. log) what happened. There were many approaches for implementing this in our code, that is for extending the core feature. So what happens is, someone will use one way and the other one will use a different way. That means, there was not a standardized approach for this. So in order to solve this, a group of people known as PHP Framework Interop Group (PHP-FIG) took up the task and came up with the standardized method “PHP Standard Recommendation 14 “which is called Event Dispatcher. For a more detailed introduction to PSR-14, there is a talk “PSR-14: A major PHP Event” by Larry Garfield at the Dutch PHP Conference 2019”.
PSR-14 in TYPO3
With PSR-14, it is possible to extend the core in a clean way without hacking the core, which would override the changes with the update of TYPO3. PSR-14 consists of four components: