Last updated August 6, 2019

Plugins are one of the ways that module developers can write code that extends Drupal 8. The Drupal 8 Plugin API allows a module to provide functionality in an extensible, object-oriented way. Plugins are used to solve the problem where you need to allow one or more modules to provide additional "things" that implement the same interface but provide distinctly different functionality. In most cases, you also want to provide a site administrator with a list of those "things" so she can choose and configure the appropriate functionality for her use case.

Plugins are grouped into plugin types which are managed by a plugin manager service. As a module developer, knowing how to implement an existing plugin type should be considered required knowledge.

Many frameworks use the term "plugin" to describe a bundle of code and other elements that can be installed in order to get access to the features they provide. In Drupal these are called modules, and plugins are one of the ways a module can add new features.

Example tasks


Plugins were introduced in Drupal 8. The API isn't going to change until Drupal 9 at least, and even then will likely only see improvements. We don't think it's going to go away anytime soon. The process for implementing plugins is relatively unchanged since before Drupal 8 was released, so older examples are likely to still be relevant.

Drupalize.Me resources

More Guides

We have guides on many Drupal skills and topics.

Explore guides

External resources

  • Plugin API Guide (
    • Community documentation for the Plugin API. Contains lots of useful information which can be somewhat hard to follow without a defined order. Use this when you have specific questions about plugin implementation, but you already know the basics.
  • Plugin API Documentation (
    • Developer-centric documentation for the Plugin API. Use this as a quick reference for reminders on how to define a new Plugin or Plugin Type. Or if you want a deep-dive into the code that makes up the Plugin API.
  • Examples for Developers project (
    • Contains the plugin_type_example module which demonstrates how to create a custom plugin type. This also teaches you a lot about how the Plugin API works. This example code was reviewed, updated, and had tests added by Drupalize.Me while creating our own content on the Plugin API. Use this if you want something you can copy/paste as a starting point, or if you learn best from reading code.
  • DrupalCon Los Angeles 2015: An Overview of the Drupal 8 Plugin System (
    • Recording of a presentation by Joe Shindelar covering the Plugin API. A good overview of the entire Plugin API, useful for learning some basic terminology, information about why the Plugin API is used, and an overview of how all the parts fit together.
  • Drupal 8 API: plugins (
    • Written overview of the Plugin API with examples of adding a new plugin type and implementing plugins of an existing type. J-P provides a good overview of the inner workings of the Plugin API, as well as providing information about Annotations and OOP conventions. This is one of the best free written tutorials on Plugins we're aware of.