---
title: "Accelerating Drupal Development with Drupal Console and Drush"
description: "Find out how you can leverage Drupal Console and Drush to speed up development time and boost productivity while creating more secure and robust Drupal websites."
url: https://www.specbee.com/blogs/accelerating-drupal-development-with-drupal-console-and-drush
type: Article
author: "Manish Saharan"
categories: "Code Corner"
published: 2022-02-22
updated: 2026-10-06
---

# Accelerating Drupal Development with Drupal Console and Drush

We’ve written extensively (we’re into this stuff) about how Drupal 8 has not just modernized digital experiences for the user but also eased out development work for Drupal developers. In this article we’re going to discuss two such Drupal 8/9 utility tools that have massively simplified and improved the way you work with Drupal code, modules and installations - Drupal Console and Drush.

## What is Drupal Console

Since the advancement of Drupal 8, it has become necessary to add a lot of boilerplate code to build a new module. Of course, you can simply copy and paste the code, but doing so repeatedly might open doors to a lot of errors. It’s ok. We’re human. Luckily, we have Drupal console - a suite of tools that you run on a CLI (Command Line Interface) that lets you automatically generate [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code#:~:text=In%20computer%20programming%2C%20boilerplate%20code,to%20accomplish%20only%20minor%20functionality.). It leverages Symfony Console and other third party components to generate most of the code needed to build a Drupal 8/9 module.

## What is Drush

Drush (Drupal + Shell) is the original CLI tool for Drupal. It lets you spin up new Drupal websites easily and helps you streamline development and administrative tasks. Drush comes shipped with many easy-to-implement commands that lets you interact with your Drupal installations, themes, modules and more. Some of the other tasks that you can perform with Drush are exporting/importing configurations, caching, updating contrib modules, updating the database and much more.

Drush works well with Drupal 6/7/8/9 and offers advantages of modern development practices. It helps save development time, both during migration of existing Drupal modules and while creating new ones thereby increasing productivity. *Learn how to create your own custom Drush commands in* [*this article*](https://www.specbee.com/blogs/writing-your-own-custom-drush-9-and-10-commands)*.*

## Installing Drupal Console

Drupal console can be installed through various methods like composer, curl, phar etc. Here is an example of installing it using composer:

### Install globally via composer

```plaintext
composer global require drupal/console
```

### Site specific installation

 1. Navigate to Drupal site in CLI:

```plaintext
cd /path/to/drupal_site
```

 2. Execute composer require command:

```plaintext
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
```

## Installing Drush

Drush can be installed through various methods as well like composer, curl or phar. Here is an example of installing it using composer:

### Install globally via composer

```plaintext
composer global require drush/drush
```

### Site specific installation

 1. Navigate to Drupal site in CLI:

```plaintext
cd /path/to/drupal_site
```

 2. Execute composer require command:

```plaintext
composer require drush/drush
```

## Drupal Console Commands and Usage

Check out some of the most popular and helpful Drupal Console commands and when they can be used.

- ### Drupal Debug Command
- To identify the breakpoints while working on themes:

```plaintext
drupal debug:breakpoints {theme_name}
```

 *Example: drupal debug:breakpoints bartik*

- To easily find the class and name of the service when working with services:

```plaintext
drupal debug:config:settings
```

- To identify the fail point when you have painful broken blocks:

```plaintext
drupal debug:plugin block broken
```

- ### Generate Custom Modules

Create custom modules within a minute using this command:

```plaintext
drupal generate:module  \
  --module="modulename"  \
  --machine-name="modulename"  \
  --module-path="/modules/custom"  \
  --description="My Awesome Module"  \
  --core="8.x"  \
  --package="Custom"  \
  --module-file  \
  --composer  \
  --test  \
  --twigtemplate
```

- ### Generate Custom Form

Custom forms requirements are very common across projects. Creating custom form easily with this command:

```plaintext
drupal generate:form  \
  --module="modulename"  \
  --class="DefaultForm"  \
  --form-id="default_form"  \
  --config-file  \
  --path="/modulename/form/default"
```

- ### Generate Config Form

As like custom forms, we require administrator configured forms as well. With this command you can create them easily:

```plaintext
drupal generate:form:config  \
  --module="modulename"  \
  --class="DefaultForm"  \
  --form-id="default_form"  \
  --config-file  \
  --path="/modulename/form/default"
```

- ### Generate Controller

With custom forms you will need controllers. You can easily create custom controllers with this command:

```plaintext
drupal generate:controller  \
  --module="modulename"  \
  --class="DefaultController"  \
  --routes='"title":"ControllerMethod", 
"name":"modulename.default_controller_hello", 
"method":"hello", "path":"/modulename/hello/{name}"'  \
  --test
```

- ### Generate Custom Entity

Creating a custom entity does not have to be time consuming, With this command you can create it quickly and easily:

```plaintext
drupal generate:entity:content  \
  --module="modulename"  \
  --entity-class="DefaultEntity"  \
  --entity-name="default_entity"  \
  --base-path="/admin/structure"  \
  --label="Default entity"  \
  --is-translatable  \
  --revisionable
  --has-forms
```

- ### Generate Custom Service

This command helps you to create custom services:

```plaintext
drupal generate:service  \
  --module="modulename"  \
  --name="modulename.default"  \
  --class="DefaultService"  \
  --interface  \
  --interface-name="InterfaceName"  \
  --path-service="/modules/custom/modulename/src/"
```

- ### Create Content like user:create

To create a user from the back-end you don’t need to open the browser and login with admin and then create an account. Simply use this command to create a user in a jiffy:

```plaintext
drupal user:create  username password  \
  --roles='authenticated'  \
  --email="username@testing.com"  \
  --status="1"
```

- ### Generate Plugin like block

Drupal Console is also capable of generating many plugins like blocks. Here is an example of creating a custom block:

```plaintext
drupal generate:plugin:block  \
  --module="modulename"  \
  --class="DefaultBlock"  \
  --label="Default block"  \
  --plugin-id="default_block"  \
  --theme-region="header"  \
  --inputs='"name":"inputtext", "type":"text_format", "label":"InputText", "options":"", 
"description":"Just an input text", "maxlength":"", "size":"", "default_value":"", 
"weight":"0", "fieldset":""'
```

*For more Drupal console commands and usage check these Available commands.*

## Most Popular Drush Commands

drush cr To rebuild Drupal cachedrush cim To import all the configuration filesdrush cex To export configuration filesdrush uli To login using one-time login urldrush en {module\_name} Enables any module either custom or contrib or coredrush pmu {module\_name} Disables and uninstalls any moduledrush pm:list Lists all modules with the package, module name, version and statusdrush updb To update the database after upgradedrush watchdog:list(ws) Lists all the watchdog messagesdrush watchdog:tail(wt) Continuous tail watchdog messagesdrush watchdog:tail --type=php Continuous tail watchdog messages with particular severity type## A Few More Cool Drush Commands

drush status Provides an overview of the current Drupal installationdrush generate As like Drupal Console, the **drush generate** command helps to generate entities, plugins and moredrush pm:security To check Drupal composer package for security updatesdrush migrate:status Lists all migrations with current statusdrush user:password {username} {password} Sets user passworddrush user:block Helps block the userdrush user:role:add Helps add user rolesdrush sql-dump Exports the Drupal database as SQL using mysqldump or equivalent.The two command line tools in focus today - Drupal Console and Drush - are quickly becoming every [Drupal developers](https://www.specbee.com/services/drupal-web-development)’ favorite gear because they are great time-savers and improve productivity. Both of them are highly extensible, in that you can create custom commands catered to your requirements. If you found this article helpful, you might want to [subscribe to our newsletter](https://specbee.us19.list-manage.com/subscribe?u=a3d560a1fc06522ef6c707339&id=689c8b7694) where you get fresh and interesting articles on Drupal, Open-Source and Technology delivered to your inbox every week!