Drupal 8 Module of the Week: Drupal Console

jam
March 1, 2016
1
2
Drupal 8 logo

Each day, more Drupal 7 modules are being migrated over to Drupal 8. New ones are also being created for the Drupal community’s latest major release. In this series, the Acquia Developer Center is profiling some of the most prominent, useful modules, projects, and tools available for Drupal 8. This week: Drupal Console.

I spoke with the four maintainers of Drupal Console: Eduardo García (enzo), CTO at AnexusIT, Jesús Manuel Olivas (jmolivas), Drupal 8 Solutions Engineer at FFW, Omar Aguirre (omers), Drupal Developer at Axtel, and David Flores (dmouse), Tech Lead at Indava.

What does the Drupal Console do?

First things first: Drupal Console is not a Drupal module per se, but rather a Symfony application that offers a lot to developers working on Drupal 8 projects. Since it’s important to know about this if you’re developing for Drupal 8, we’re just including it here rather than coming up with a weaker title for this blog series like ”Drupal 8 modules and other useful stuff of the week.”

Drupal Console is a command line interface (CLI) tool that helps you as a developer by helping you with Drupal 8 code: generating boilerplate code (aka the basic “scaffolding” you need for every module you write), and interacting with and debugging Drupal 8 code. Drupal Console also lets you download and install modules; create dummy data, tests, and database logs; and debug not just registered services, but also various D8 subsystems like the configuration, routing, and state subsystems--all via the command line.

As of early 2016, Drupal Console has been downloaded more than 42,000 times.

An international tool for an international project

One of the most important features of Drupal Console to its maintainers is the fact that it is fully multi-lingual and fully translatable, just like Drupal 8 itself.

Eduardo “Enzo” Garcia explains, “We truly believe in the idea that no language is more important than any other. For that reason, the Drupal Console project already supports 12 languages and we’re hoping local communities will add more. We feel that this helps remove one more obstacle to Drupal adoption around the world.”

Here is the status of translations for the currently-supported languages:

  • English 100%
  • Hindi 98.92%
  • Chinese (simplified) 91.68%
  • Spanish 90.6%
  • Vietnamese 82.51%
  • Romanian 79.58%
  • Catalan 69.03%
  • Hungarian 63.56%
  • Portuguese 60.94%
  • French 38.75%
  • Russian 31.43%
  • Japanese 28.97%

The team is also working on a GUI for Drupal Console as an alternative to the CLI (you can find this project at http://drupalgenerator.com/). This could be especially useful for site builders wanting to generate code or issue site commands, without needing to use the command line. It could also be used for code generation in the form of a downloadable compressed file.

Why is this important?

Drupal Console has been designed to increase Drupal developer productivity by helping generate code immediately. Because the Drupal Console takes care of the necessary boilerplate code and other basic functionality, you can focus your effort on the business logic of your application--the part that delivers value to your organization.

Drupal is infamous for having a steep learning curve, complete with its own language of “Drupalisms.” While Drupal 8 simplifies and standardizes the development process, it is more technically advanced and complex than its predecessor. Managing this increasing complexity of Drupal 8 could be a daunting task for some. Drupal Console is designed to help you manage that complexity.

Drupal Console can also help developers learn the ins and outs of Drupal 8 by using the "--learning" flag, which increases output verbosity.

Drupal Console in action: Examples

You can see examples of Drupal Console generated files here:

Download, install and serve Drupal 8 using one command:

$ drupal chain --file=~/.console/chain/quick-start.yml

 download, install and serve Drupal 8 using one command

Generate a module:

$ drupal generate:controller

Drupal Console: generate controller example

When was Drupal Console created?

Drupal Console was born during DrupalCamp Costa Rica 2013, after a conversion between Larry “Crell” Garfield, Jesus Manuel Olivas, and David Flores about the benefits of making the Symfony Console component available for Drupal 8.

Jesús Olivas elaborates, “Originally we were trying to learn Drupal 8 and reduce the time required to learn Drupal (you know, time is money). The project was born as a scaffolding module generator with the goal of speed up Drupal 8 adoption, but as the project evolved, new features were added and it has turned into a full CLI tool for Drupal 8.”

Fast forward to 2016 and Drupal Console has been in development for almost 3 years. The core maintainer team is made up of four developers and there are more than 130+ Drupal Console contributors around the world.

Has Drupal 8 changed Drupal Console?

Drupal Console was born as a Drupal 8 project. From the ground up, it has been built to utilize the same modern PHP practices that were introduced in Drupal 8. It builds on the Symfony Console and other third-party components, gaining a lot of advantages and minimizing risks, because we are standing on the shoulders of friendly PHP-community giants. The team is currently working on integrating Drupal Console with Drupal 8 modules such as Webprofiler (Devel), Drupal Commerce, Metatag and Scheduled Updates. The team is also adding custom functionality to other modules.

Future plans

The Drupal Console team is working on a GUI for Drupal Console as an alternative to the CLI. You can find this project at http://drupalgenerator.com/. This could be useful for site builders uncomfortable with using the command line, but who still want to generate code or issue site commands. The team envisions the generated code being delivered in the form of downloadable, compressed files.

Learn more about Drupal Console

Thank you!

Thank you to the following organizations for their generous support of the development for Drupal Console: FFW, AnexusIT, and Indava.

Sign-up for our Developer Blog Newsletter

Thanks!

Add comment

By submitting this form, you accept the Mollom privacy policy.

Great articule

The best tool for D8 development. Thank you for sharing this here.