Drupal is revered as one of the magnificent CMS and development platforms to build websites. It is widely accredited for its flexibility that comes, in part, from the massive community across the project. The entire Drupal community is made up of more than 1 billion users that provide massive support in creating the beautiful themes and websites. In this blog I will share the insights about ways to manage the Drupal sites using Composer and Drush.
Composer is the dependency manager for PHP and helps to find and download the dependency as per the requirement. On the other hand, Drush is a command line shell for Drupal.
You can install the Drupal 8 Composer as per the installed Operating System of your computer. Have a look at the following links to get the idea for the same:
Please use the following command to easily install the drupal site using composer. This command will download the drupal in your project folder.
$ composer create-project drupal-composer/drupal-project:8.x-dev my_project_name_dir --stability dev no-interaction
By using the drupal composer, we can download or manage the module, themes, and other drupal specific dependencies from drupal.org. However, if you have created the project without the composer, you need to edit the project composer.json file for add module and themes dependencies etc.
How to define the drupal.org as source of drupal packages
Drupal.org provides the set of own directories and modules to use composer. However, we need to set and edit composer.json of your project.
If you want to add any drupal module in your project, run the following command:
$ composer require drupal/<modulename>
$ composer require drupal/path
Note: If you run the above command with “require” then composer will automatically update your composer.json. Composer will download the module but will not install in your project. You need to install manually or using “drush”
Drush provides a lot of commands to manage drupal projects. Drupal 8 drush can enable or disable any module using drush command and also any changes related to configuration etc.
If you like the blog, don’t forget to share it across the social media channels like facebook, Twitter, LinkedIn, Quora and more. For any brickbats or queries regarding Drupal 8 projects, feel free to comment in the comment section below.