Module Development

Events for Drupal 7, 8, 9, and 10

Events in Drupal allow various system components to interact and communicate with one another while remaining independent, or decoupled. They are one of the ways that module developers can alter or extend Drupal without modifying existing code. (Other ways include Plugins, Hooks, and Services). The system consists of an event dispatcher which is used to trigger a known event at a specific point during code execution. It also consists of a pattern for subscribing in order to be notified whenever an event is triggered by the dispatcher so that your custom code can react.

The event system is built on the Symfony event dispatcher component and is an implementation of the Mediator design pattern.

Example tasks

  • Subscribe to an existing event in order to react with custom logic whenever the event occurs
  • Dispatch a new event when critical actions happen in your code, giving other components the option to react


The event system in Drupal is unlikely to change for a while. Expect contributed modules to start dispatching events in place of invoking hooks for some types of interactions.

Drupalize.Me resources

Drupal 8, 9, and 10
More information

Drupal uses events to allow modules and various subsystems to communicate with one another in an object-oriented manner. Understanding how the Event API works is critical knowledge for all module developers. In this tutorial we'll:

  • Explain what events are
  • Discuss the use case for subscribing to events
  • Give an example use-case for dispatching events

By the end of this tutorial you should be able to explain what events are, understand when to use them in your own code, and know where to learn more about how to do so.

Drupal 8, 9, and 10
More information

Modules can declare their interest in being notified when a specific event, or events, are triggered by implementing an event subscriber. This can be used to react to events in order to add your own logic, or to alter Drupal's existing functionality.

In this tutorial we'll cover how to subscribe to an event from your own module. After completing this tutorial you should be able to subscribe to any event and ensure that your custom code is executed when the specific event is triggered.

Drupal 8, 9, and 10
More information

Some events are dispatched by Drupal core, some by underlying Symfony components, and some by contributed modules. The list of events that you can subscribe to in order to tie into Drupal varies depending on the modules you've got installed. This can make it tricky to get a complete list.

In this tutorial, we'll look at a few different ways you can get a complete list of the available events for your Drupal application, as well as where to find documentation for those events.

Drupal 8, 9, and 10
More information

Modules or subsystems can dispatch events in order to allow another developer to subscribe to those events and react to what's happening within the application. As a module developer you'll learn how to:

  • Define, and document, new events
  • Define new event objects
  • Use the event dispatcher service to alert event subscribers when specific conditions are met in your own code.

By the end of this tutorial you should be able to explain the use case for dispatching events, and be able to trigger one more events from within your own code.


Not sure where to start? Our guides provide useful learning tracks for all skill levels.

Navigate guides

External resources

  • Events (
    • Technical overview of Drupal’s event dispatching and subscribing systems. Use this if you’re already familiar with the concept of events and you’re just looking for a quick reminder of how the pattern works within Drupal.
  • Symfony event dispatcher component (
    • Documentation for the Symfony event dispatcher, upon which Drupal’s event dispatcher is built. Knowing how it works will help you better understand Drupal’s dispatcher.