[SOLVED] How to install Drupal 9 with Composer?

| | 1 min read

We can install the latest version of drupal9 using the following command.

composer create-project drupal/recommended-project my_site_name_dir

This will create a project in 'my_site_name_dir' and automatically execute composer install to download the latest stable version of Drupal and all its dependencies.

Your 'my_site_name_dir' will contain files that should be outside of your web root and not accessible by the web server. The web root will be 'my_site_name_dir/web'.

The above command is used to install the current official release of Drupal. if you want to install a specific version, add the version number to the command after a colon. For example, to download version 9.3.3:

composer create-project drupal/recommended-project:9.3.3 my_site_name_dir

Reference

https://drupal.stackexchange.com/questions/292192/command-to-install-drupal-9-with-composer

https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies