The end of Hooks

Drupal 8 will ship with not one but two event systems. One is the Symfony Event Dispatcher. The other is hooks. But really, do we need two event systems? No, we don't.

Hooks have served us well for many years, but I believe it is time to let them go. Hooks are not compatible with unit testing, with dependency injection, with lazy-loading of code, or any of the other techniques and approaches that Drupal 8 and later will be built on. Events are more powerful, cleaner, and have less baggage from the PHP 4 era.

For Drupal 9, let's rip off the band-aid. Let's give hooks an honorable burial and move forward.

It's not a trivial transition, and there are still some questions to sort out. This session will present an argument for moving entirely from hooks to events, lay out the benefits of doing so, and highlight some of the difficulties. Then, as any good conversation, it will invite suggestions on how to address those difficulties.

Schedule info
Status: 
Proposed
Session Info
Speaker(s): 
Track: 
Core Conversations
Experience level: 
Advanced

Comments