This project is not covered by Drupal’s security advisory policy.

This modules allows you to implement Drupal hooks with object-orientated classes, this has a number of benefits:

  1. Your hooks live in classes, much more inline with Drupal 8
  2. Your hooks can use dependency injection, great for testing etc.
  3. You can use a class to organise your code rather than having monster size hooks or global functions that are only used as hook helpers.
  4. The overhead of running this module is nearly zero on normal pages, it will add a few hundred milliseconds to a cache clear though.

Currently this module only supports alter hooks although i'm discussing approaches to support invoke() and invokeAll() - https://www.drupal.org/node/2595769

Do not use this module in production yet, the architecture is not finalised.

Current Usage

Events - Create an event subscribe called "hooks.$your_hook_name" , you will receive an instance of HookEvent.
Implicit - Currently commented out in our ModulerHandler override, allows you to simply put the class in the right location to work. Likely to be removed in #2611020: Remove implicit style hooks

Supporting organizations: 
Sponsored Development

Project information

Releases