Hero image for: What is Drupal Console for me

What is Drupal Console for me

By Eduardo García ● CTO | January 25th, 2015

drupal console logo Maybe you hear about the project Drupal Console or perhaps not because is an independent project related to Drupal 8.

If you are an older Drupal user/developer, you could find some similarities with Drush Project, and to be honest, there are some similarities.

But if you are a Symfony developer, you will find some similarities with Console Component and actually, it’s what it is, Drupal Console is an implementation of Symfony Component to meet the Drupal 8 Way.

The Drupal Console, embrace the principles of Drupal 8 about using Symfony 2 components and other libraries to solve the commons problems instead to reinvent the wheel for everything, that concept is called PIE ( Proudly Invented Elsewhere).

Using the Symfony Console Component David Flores and Jesus Olivas start a project to implement the same concept from Symfony to Drupal 8.

One of the incentives to create the project Drupal Console was have a pet project to force them to learn the Drupal 8 way.

But now the project is not a pet project anymore, you can see the full list of contributors at https://github.com/hechoendrupal/DrupalAppConsole/graphs/contributors and if you want to be part of this project drop a message using the Gitter room https://gitter.im/hechoendrupal/DrupalAppConsole .

The majority of commands in Drupal Console require a Drupal 8 instance because the bootstrap of Drupal 8 is loaded to have access to all classes and libraries used in Drupal 8, to avoid reinventing the wheel. But of course, you can contribute commands without dependency of Drupal 8.

Right now the Drupal Console has 28 commands listed below.

$ drupal list
Drupal Console version 0.6.5

Available commands:
 cr                              Rebuild and clear all site caches.
 drush                           Run drush from console.
 help                            Displays help for a command
 list                            Lists commands
 self-update                     Update the console to latest version.
 cache:rebuild                   Rebuild and clear all site caches.
 config:debug                    Show the current configuration.
 container:debug                 Displays current services for an 
 generate:command                Generate commands for the console.
 generate:controller             Generate & Register a controller
 generate:entity:config          Generate a new "EntityConfig"
 generate:entity:content         Generate a new "EntityContent"
 generate:form:config            Generate a new "ConfigFormBase"
 generate:module                 Generate a module.
 generate:plugin:block           Generate a plugin block
 generate:plugin:imageeffect     Generate image effect plugin.
 generate:plugin:rest:resource   Generate plugin rest resource
 generate:service                Generate service
 migrate:debug                   Display current migration available for 
  the application
 migrate:execute                 Execute a migration available for 
 module:debug                    Display current modules available for 
 module:download                 Install module or modules in the 
 module:install                  Install module or modules in the 
 module:uninstall                Install module or modules in the 
 router:debug                    Displays current routes for the 
 router:rebuild                  Rebuild routes for the application

Most of them are oriented to generate code to speed up the process of development for Drupal 8, but in the same way of Symfony Console has commands to interact with Cache, Migrate and Database you can contribute modules for any purpose, so your imagination is the limit.

In my case, I’m the contributor to commands related to Drupal 8 Migrate and Modules integration. My inspiration to create these commands wasn’t to replace Drush; my ideas were to understand how the Migration process works and be aware of the module activation process.

After complete these commands now I can say I understand how Drupal 8 Migrate process works and how a module is installed and uninstalled.

But the learning process doesn’t end in Drupal 8 components when I try to create the command module:download I have to declare libraries Zippy and DOMQuery as dependencies using Composer. Why code those libraries myself if I can use code created for non-Drupal Developers :P.

So right now we are looking for testers and coders for new commands to improve the Drupal Console, if you think you can contribute with Drupal Console core, you are more than welcome.

Also, we expect in the future contribute to Symfony Console Component some code based in our needs, again why to create an island of code, instead of that pushback code to the core and help other Open Source projects.

Related Posts