Modules are bundles of primarily PHP code that extend Drupal in order to add new features or alter existing functionality. Modules can be installed to enable their features, and uninstalled to turn the features off. This flexibility allows Drupal users to tailor each instance of Drupal to their specific use-case, and to use only the features of Drupal that they need. There are thousands of community-contributed modules available. A large part of learning Drupal involves learning how to locate, install, and evaluate existing modules in order to determine if the functionality they provide is what you need.
There are three main types of modules:
- core modules: modules that are included with Drupal core and live in the /core/modules directory
- contributed modules: modules downloaded from Drupal.org that are not part of Drupal core, and are typically placed in the /modules/contrib directory
- custom modules: project-specific modules that you or another developer wrote specifically for your application, and are typically placed in the /modules/custom directory
- Locate a contributed module on Drupal.org and install it on your site
- Write a custom module for a project that adds new features or alters existing ones
The basic concept of modules, how they are integrated into a Drupal site, and the role they play is unlikely to change, so we have high confidence in modules.
For Drupal 8, we recommend using Composer whenever possible to manage Drupal core and contributed module code for your projects.
This series walks through writing a module from scratch and implementing some of the most common APIs and design patterns used by Drupal.
See also the following topic pages: