Drupal 8 - Installing with composer

The best way to install Drupal 8 and 9 is by using Composer. There are several options, but the most widely used and easiest way is to use the Composer template for Drupal projects. To install Drupal 8 or 9 use the following command:

composer create-project drupal-composer/drupal-project:8.x-dev some-dir --no-interaction

or if you want to install it in the current directory use this:

composer create-project drupal-composer/drupal-project:8.x-dev . --no-interaction

To update the existing project that is based on this template use the following command:

composer update drupal/core webflo/drupal-core-require-dev symfony/* --with-dependencies

Update on October 24, 2020.

As of the release of Drupal version 8.8, the recommend Composer template changed from drupal-composer/drupal-project to the officially supported template drupal/recommended-project.

To create a new project in the 'my_site' directory and automatically execute composer install, use the following command:

composer create-project drupal/recommended-project my_site

The above command will download the current release of Drupal. If you want to download a different version, add the version number to the command. For example, to download version 8.9.7:

composer create-project drupal/recommended-project:8.9.7 my_site

About the Author

Goran Nikolovski is a senior web developer who loves working with Drupal, React, and React Native. He is the founder of this website and he enjoys sharing his knowledge. Need help with anything? Get in touch.