Install Command-line utilities for Drupal 8

If using the drupal/recommended-project template, it doesn't contain the site local Drush and Drupal Console binaries by default. Here's how to get them running.

When following the basic instruction for Setting up a New Drupal Installation there's another step.

composer require drush/drush

composer require drupal/console

Drush uses the "drush" command. To see a list of Drush commands:

drush help

Drupal Console uses the "drupal" command. To see a list of Drupal Console commands:

drupal list

 

Article references

Add new comment

comment editor

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Setting Up a New Drupal 8 Installation

To begin, use composer to download the default project profile.

Do a default install with Composer:

composer create-project drupal/recommended-project PROJECT_NAME --no-interaction

Do a modified install with Composer:

To make modifications to the composer.json file before installing, use this command:

composer create-project drupal/recommended-project PROJECT_NAME --no-interaction --no-install

From here, make any modifications to the composer.json that you want to include during install. Since using command-line utilities Drush and Drupal Console will be essential, this can be added to composer.json and included in the installation.

    "require": {
    },

and add two lines beneath the current content in the "require" section:

    "require": {
        "drupal/console":"~1.0",
        "drush/drush": "^10.1"
    },

One the desired modifications have been made, return to the terminal and:

composer install

Complete the install

This will download all the required Drupal 8 core files based on the information in your composer file.

The output instructions require one more step before install:

  * Remove the plugin that prints this message:
      composer remove drupal/core-project-message

Move into your project directory and issue the command

cd PROJECT_NAME
composer remove drupal/core-project-message

Using command-line utilities

After install, if you haven't already used the instructions above, you'll want to include the very useful command-line utilities Drush and Drupal Console. They don't come with drupal/recommended-project. These tools provide powerful ways to speed up your development process.

Next Steps

Article references

Add new comment

comment editor

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.