Skip to main content
Boris Willi
Drupal Module

How to extend the range of functions in just a few steps. Drupal 10 offers over 6,200 modules (as of 7.9.2023) - here's how to install them!

What are Drupal modules?

In Drupal, certain functionalities are provided in so-called modules. The core system of Drupal 10, also known as Core, has 52 modules. These provide the basic functions and also extend the range of functions with optional modules (such as a forum).

If these are not enough, you can help yourself from the Drupal community and thus expand the possibilities of the system almost endlessly.

With a total of over 50,000 modules provided (so-called contrib modules) and more than 6,200 compatible modules for the current version 10 (as of 7.9.2023), Drupal allows us to build and customize a website according to our own ideas using existing modules and themes alone. The globally active Drupal community ensures that these extensions are always updated and kept secure.

Nevertheless, there are of course always requirements that are not covered by a contrib module. This is where custom modules come into play. These modules are programmed with PHP and extend Drupal as required. You can find out what custom modules are or how to create your own modules in our blog article"Two easy ways to create a Drupal module".

How to install a Drupal module

Installing a Drupal module is done in three steps: search for module, integrate module and install module. These are described in detail below:

Step 1: Search for a module

You can find a list of all available modules on the module page on drupal.org. Call up the module overview on drupal.org here.

Here you can search for specific modules, but also discover completely new ones: e.g. there is an overview of the modules that have been downloaded or installed most frequently by the Drupal community. Once you have landed on the module page of a desired module, you will find a short summary of the module, links to documentation, statistics and further information.

Once you have found a suitable module, continue with step 2: Integrate module. In our example, we use the very frequently used "Token" module.

Once you have landed on the module page of a desired module, you will find a brief summary of the module, links to documentation, statistics and further information.

Once you have found a suitable module, continue with step 2: Integrate module. In our example, we use the very frequently used "Token" module.

Step 2: Integrate module

In the lower section of the Token module page, you will find the available releases separated by main version. Only use versions with a green background. If the background is yellow, you should first check the release notes to find out whether it is safe to use on your site. You can find these by clicking on the blue version number at the top left of the box.

Also look for the shield icon next to the version number before downloading a module. These security advisories are managed by the Drupal Security Team and mark modules that are compliant or non-compliant with the security standards.

Once you have selected the desired version, you have two options for integrating the desired module into your Drupal 10 installation:

Composer ist ein Dependency Manager (Paketmanager) für PHP, welcher sich darum kümmert, Abhängigkeiten aufzulösen und alle benötigten Bibliotheken automatisch in der konfigurierten Version in Ihr Projekt herunterzuladen. Sollte Composer bei Ihnen noch nicht installiert sein, finden Sie hier eine Anleitung für Linux. Contrib-Module, die von der Community bereitgestellt werden, können oft mehrere Abhängigkeiten haben. Ohne Composer müssten Sie sich beim Herunterladen der Module um alle Abhängigkeiten kümmern. Das Herunterladen über Composer ist die von Drupal empfohlene Vorgehensweise. Weitere Informationen darüber, wie Sie Composer mit Drupal verwenden finden Sie hier.

Mit dem folgenden Befehl über die Kommandozeile können Module mit Composer installiert werden.

composer require drupal/module_name

Kopieren Sie am Ende ihrer Modul-Seite im Bereich “Releases” den Befehl neben “Install” und führen diesen aus. Um das Modul “Token” herunterzuladen, führen Sie beispielsweise folgenden Befehl aus:

composer require 'drupal/token:^1.12'

Falls Sie nicht die aktuellste Version eines Moduls herunterladen möchten, sondern eine bestimmte Version, können Sie die Version wie folgt angeben:

composer require ‘drupal/module_name:version’

Weitere Informationen dazu erhalten Sie hier unter “Specifying a version”.

Wenn sie den gewünschten Befehl ausführen, wird automatisch ein neuer Ordner “token”  in “modules/contrib” angelegt und das Modul steht Ihnen nun in der Liste aller verfügbaren Module zur Aktivierung bereit. Beachten Sie, dass Module durch diesen Befehl nur heruntergeladen, aber nicht eingeschaltet werden!

Grafik zeigt einen Verzeichnisbaum.

Um einen manuellen Download-Link zu erhalten klicken Sie auf die blaue Versionsnummer oben links im Kasten. Auf der anschließenden Seite auf den gewünschten Link im Bereich “Alternative installation files”.

Alternative Downloadmöglichkeiten in Textform auf der Drupal-Modulseite.

In Drupal einbinden

Nach erfolgreichem Download entpacken Sie das Modul und erhalten einen Ordner, der nach dem Modul benannt ist. Nun muss der Ordner in Drupal eingebunden werden. Dazu verschieben Sie diesen Ordner in Ihr Projektverzeichnis. Module, die von der Drupal-Community bereitgestellt wurden, werden standardmäßig in den Pfad “modules/contrib” abgelegt. In unserem Beispiel muss der Verzeichnispfad also modules/contrib/token lauten.

Grafik zeigt einen Verzeichnisbaum.

Step 3: Install the module

After you have integrated the module code into your Drupal installation, you still need to install the module. There are also two ways to do this.

Installation via the backend

Go to "Extend " in the admin area of your site. There you will see a list of all the modules that are available to you. In addition to a short description of the module, you will also receive information about the version of the module, "requirements" (dependencies of modules), or you can go directly to the module configuration.

To install, select the checkbox next to the module name "Token" and then click on the Install button at the bottom of the page. Done.

Installation with Drush

A module can also be activated via drush. Drush stands for Drupal Shell and is a terminal tool for managing Drupal websites. Drush makes it possible to carry out a variety of administrative tasks directly in the command line. This not only saves a lot of time, but also allows the developer to concentrate on their work without being distracted by switching back and forth between the terminal and the user interface. To activate a module with drush, execute the following command:

drush en module_name

To switch on the "token" module, for example, execute the following command:

drush en token

CONCLUSION

We hope that this article has shown you various ways and tools to help you successfully download and install a module.

Even though we have already mentioned that Composer is the way recommended by Drupal to manage dependencies of modules and other extensions, the manual way remains open, of course.

Are you still working with an outdated Drupal version? We offer an upgrade service, find out more: Drupal 10 Upgrade

Book tips