Backend and Infrastructure

Drupal Console for Drupal 8, 9

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Some (not all) features of Drupal Console are available in Drush. See Install Drush Using Composer.

The Drupal Console is a suite of tools run from a command line interface (CLI) to generate boilerplate code and interact with a Drupal installation.

Note: This project is no longer actively maintained. See the Drush topic for alternative solutions.


Learn about the Drupal Console and what you can do with it.


Installing Drupal Console

To get up and running with Drupal Console, follow the instructions in the project's official documentation: Getting the project.

Tip: If you're running into difficulty installing Drupal Console with an existing site (and dependencies are not resolving), try passing the --no-update flag, which will disable automatic updates of dependencies.

composer require drupal/console:~1.0 \
--prefer-dist \
--optimize-autoloader \
--sort-packages \

composer update

What does Drupal Console do?

For a complete list of commands run drupal list, or view the documentation.

Generate code

Drupal Console provides a number of commands for creating module scaffolding and boilerplate code. Generation commands will walk you through a set of interactive questions about what you want to generate. Then it will generate the required boilerplate to build the requested component. This can dramatically decrease the time it takes to write common components like plugins, services, or custom entity types.

Note: When using Drupal Console to generate a module or theme, you will need to edit the info file and add the core_version_requirement key. For details, see Create an Info File for a Module and Describe Your Theme with an Info File.

Try out various Drupal Console's code scaffolding commands in the following tutorials:

Interact with your Drupal installation

Drupal Console allows you to interact with your Drupal installation, from rebuilding caches, to listing routes, services, and modules, and interacting with the configuration management.

One of our favorite features is that Drupal Console will create lists of things like plugin types, events, and services available. Because it's being used in the context of your specific installation, that list will include options provided by any contributed modules not just Drupal core. This means the documentation provided by Drupal Console in the context of your site will be a bit more complete than what you might find online.

Learn to develop with Drupal

Drupal Console helps you learn to develop applications with Drupal. In addition to generating complex code, you can increase the verbosity of the code comments, to better understand the generated code and how to build on it, by using the --learning option.

You can also use Drupal Console to explore the inner workings of your current installation using the debug:* commands.


In this tutorial, we learned about some things you can do in a Drupal project with the command-line interface tool, Drupal Console.

Further your understanding

Additional resources

Drupal Module Development