6 Easy Steps To Install Drupal With Composer

Composer is now the method of choice for installing Drupal, as it is the preferred method. Both the installation of Drupal’s core as well as contributed modules and themes can make use of this resource. Check out our concise yet in-depth step-by-step guide to installing Drupal Composer.
Drupal Installation Requirements
If you have settled on Drupal as the platform upon which to construct your website, you will need to ensure that the prerequisites for CMS installation are met. A web server and a database server are required for the procedure as they are the two fundamental components. The fundamental stack of the most widely used operating systems makes calls to AMP, which is an acronym for the following:
- Web pages are served using Apache (or another web server, such as Nginx),
- MySQL (or another server for a database, such as MariaDB),
- (PHP) (in a version that is supported by a certain release of Drupal).
In order to ensure a successful installation of its core, you will need to ensure that you satisfy the requirements of the specific Drupal version you are using.
Why Should You Make Use of Composer When Installing Drupal 8 or 9?
Composer is a piece of software that assists in the management of PHP dependencies. Why is this method of installing Drupal 8 or 9 more convenient than others? In the first place, it makes the maintenance of Drupal and its dependencies, such as modules, libraries, themes, and so on, simple and visible. In addition to this, it verifies that the most recent version of each module and theme has been installed on your website. In addition to this, there is an official project that simplifies the installation of Drupal with Composer. It is complete with all of the necessary information that is required for this procedure. Composer is highly recommended for the installation of Drupal, and the aforementioned reasons are just a few of the many reasons why. We could write down other reasons, but that is not the goal of this text.
Read this:- Benefits Of Using Drupal With Node.js
Drupal Installation with Composer – Step-by-Step
Before Composer became popular, the most frequent method for installing Drupal was done so through the use of Drush or the Drupal Console. At this time, Composer takes care of the download procedure on its own. You will find the necessary instructions for installing Drupal with Composer further down in this article.
1. Install Composer
The installation of Composer on your local system is the first and most significant item that has to be done. On that page, you may look for step-by-step instructions that explain how to carry out the aforementioned steps using a variety of operating systems, such as Windows, macOS, or Linux.
2. Download Drupal Core Using Composer
Composer template Drupal/recommended-project is what you need to use to successfully download Drupal 8 or 9 core. As a result, you will have the peace of mind of knowing that the fundamental dependencies are compatible with the official release. Since Drupal 8.8.0, the default template has shifted from Drupal-composer/drupal-project to the actual Drupal/recommended-project directory. This is an important change that should be noted.
To successfully install Drupal 8 or 9, you should use the following command:
composer create-project drupal/recommended-project my_site_name_dir
The Drupal/recommended-project package will be downloaded directly to the my_site_name_dir directory when you use this command. It will automatically activate the composer install command, which will download the most recent stable versions of Drupal core as well as any dependencies Drupal may have.
In my_site_name_dir you can find all files unavailable for the web server and those which should be placed out of the webroot.
3. Download a Specific Drupal Core Version via Composer
The command that was just described will download the most recent version of Drupal, such as 9.2.0. You will need to use a separate command in order to download a different version, such as Drupal 8.9.1, for example.
composer create-project drupal/recommended-project:8.9.1 my_site_name_dir
4. Download Contributed Modules and Themes Using Composer
You have already completed the installation of the core of Drupal. It is time to start expanding its capabilities by adding modules and themes at this point. You can accomplish all you need to do with Composer. You will need to execute the following command at the root of your Drupal site to download the donated module or theme along with all of its external dependencies:
composer require drupal/<modulename>
Let’s take it for granted that it will be a Pathauto module. The command will then look like this after that:
composer require drupal/pathauto
Pathauto will be added to the requirements in the updated composer.json that will be generated by Composer.
Pathauto will be added to the requirements in the updated composer.json that will be generated by Composer.
5. Download a Specific Version of Contributed Modules or Themes
In a manner analogous to that which was described for Drupal’s core, you can specify the version of a module or theme you want to install. To do this, use the following command:
composer require ‘drupal/<modulename>:<version>’
For example:
composer require ‘drupal/pathauto:^1.8’
6. Changing Locations of Packages
You can specify where the downloaded packages should be installed after they have been extracted. To make this work, you will need to edit the “installer-paths” section of the composer.json file. Utilize the following configuration:
“extra”: {
“installer-paths”: {
“core”: [“type:drupal-core”],
“libraries/{$name}”: [“type:drupal-library”],
“modules/contrib/{$name}”: [“type:drupal-module”],
“profiles/contrib/{$name}”: [“type:drupal-profile”],
“themes/contrib/{$name}”: [“type:drupal-theme”],
“drush/{$name}”: [“type:drupal-drush”],
“modules/custom/{$name}”: [“type:drupal-custom-module”],
“themes/custom/{$name}”: [“type:drupal-custom-theme”]
}
}
Without using Composer, how would one go about installing Drupal 8 or 9?
Composer was described before as a method that is suggested to use while installing Drupal. There are, however, other options available to you in the event that you do not wish to or are unable to make use of Composer. Installing Drupal via the command line using Drush is just one example of the many options available.
In a nutshell, you need to incorporate the following command into your project:
composer requires drush/drush
and then use the drush site:install.
Managing Drupal Site with Composer
Composer isn’t just for installing Drupal 8 or 9, though it can do that too. You’ll have no trouble using it to manage updates to Drupal’s core, as well as upgrades to additional modules, themes, and libraries. Check out the following links if you are looking for a reputable source of information on this topic.
Conclusion
Composer significantly accelerates and simplifies the processes involved in installing Drupal 8 or 9. You will no longer be required to manually download the CMS core, and in addition to this, you will be able to utilize the tool in the future to manage your site along with its dependencies.
Moreover, if you are looking for a Drupal development company that can help you with all your Drupal-related solutions then you should check out Appic Softwares. We have an experienced team of Drupal developers that will assist you.
You can even hire dedicated Drupal developers from us and let them manage your project. So, what are you waiting for?
Related Articles

What Is Drupal Configuration Synchronizer?
Drupal’s strong configuration Synchronization system assists developers in easily importing and exporting setups between multiple Drupal website instances. The synchronizer will assist you in several ways, such as allowing you to manage and deploy configuration changes across different environments in a structured and efficient manner. Now, if you are looking for best practices or strategies […]

The Hourly Rate Of Hiring Drupal Developers From India
Do you know total of 469,323 live Drupa l websites are running across the globe? If you too have a Drupal website or are planning to create one and want to know the hourly rate of Hiring Drupal developers from India, then you are at the right place. Check out the content of this post […]

What Are Action Plugins In Drupal? Know Everthing Here 2025
Explore the versatile landscape of Drupal’s Action Plugins in 2024, uncovering their role in extending functionality and promoting code reuse. From seamless integration to scalability, our guide delves into the intricacies of Action Plugins, providing a comprehensive understanding of how they enhance the development process within the dynamic Drupal framework. Let’s delve deeper into the […]

A Complete Guide On Web-Front Module For Drupal 10
Drupal’s most potent and versatile form builder and submission manager is the Webform module. It enables site builders to quickly and simply create complicated forms. It allows you to customize it to meet your needs and comes with a set of default settings. Visit this wonderful blog: Drupal 9 Webform Module. A succinct tutorial to […]

How To Handle Custom Drupal Migration Using SQLBase?
The field of Drupal migrations is a hive of activity. On November 1, 2023, Drupal 9 reached its End of Life (EOL). The final extension for Drupal 7 is January 2025, when it will go EOL. Drupal 10.1.6, the most recent version, was released on November 1, 2023, following the release of Drupal 10 in […]

Step-By-Step Guide To Update Drupal Core With Composer
Updating the Drupal core and adding modules to the most recent version that has been released is best practice. Let’s get started with updating the core of Drupal. Although there are several approaches to upgrading the core, we are only talking about it with the composer at this time. Using Composer is also advised when […]





