How to enable a module in Drupal 8?

We can either use drush en `module_name` command or can enable a module from the administrator dashboard. but let's see the step-wise process of doing that.

Okay, let's take an example of 'animate' module, we will install and enable it.

Step 1:- Install module using composer

There are few other ways to install modules like by using drush dl command and manually downloading and placing module to contrib directory but we will install it using composer command since it's a best practice. Composer command to install a module can be found on module's project page.

Module composer command.

 

Now, From terminal move to your project root where composer.json is kept, and run the following command.

composer require 'drupal/animate:^1.2'

The above composer command will download the module and its dependencies into contrib directory.

Step 2:- Enable the installed module.

Once module is downloaded through composer, We can enable the module using Drush command as shown below.

drush en animate

Or we can use administrator dashboard to enable the module. 

To enable module through admin dashboard, Follow the below procedure.

  • Navigate to Extend from admin menu.
  • Search for the installed module using filter input.
  • Check the module and click on install.
Install Drupal module.

 

And, we are done with installing, to uninstall the module, Navigate to Extend > Uninstall or run the following Drush command.

drush pmu animate