Installing modules from the command line
In addition to installing modules via the user interface, you can also download and install modules from the command line:
- The recommended method for downloading modules (and themes) is via Composer. However, you can still use Drush 8 or Drupal Console to download modules, but they won’t update your composer.json file.
- Both Drush and Drupal Console can install modules and themes for you. (In Drupal 8, installing and enabling a module are the same step.)
Downloading and installing modules from the command line is the fastest way to extend your Drupal setup.
Drush
In Drush 8, you can download a module using the command:
drush dl module_name
To enable the module with Drush, run:
drush en module_name
Clear the cache using:
drush cr
Open your browser and refresh the page. You’ll see the module’s functionality added to the site.
Drupal Console
To enable a module using Drupal Console, run:
drupal moi module_name
To download a module using Drupal Console, use:
drupal mod module_name
Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.