How to install and remove Drupal 8 modules at the command line with Composer

I find Drupal 8 module management to be confusing, but one thing I’ve learned is that you can install and remove Drupal 8 modules with Composer at the command line.

Adding a Drupal 8 module with Composer

The short story is that to add a new module — such as the reCAPTCHA anti-spam module — you type this command at the command line (in the root directory of your Drupal 8 website) to install it:

Notes on how to update a Drupal 8 website with Drush and Composer

The process of updating a Drupal 8 website has changed dramatically recently (March-April, 2018), so I deleted the older content on this page and replaced it with the content below.

As of April, 2018 you now need to use Composer along with Drush to update your website. Here are my very brief notes on how to do this: