Skip to main content

Drupal Console and Drush collaboration efforts

Posted on Apr 12, 2016

The Drupal Console team has analyzed the proposal of one of the Drush co-maintainers in the blog post "Modern Command Line Tools for Drupal". We continue to agree to collaborate and share efforts to create libraries that any Drupal CLI project can take advantage of. With that said, we don’t agree with creating a new Drupalisim or a new Drupal way to write symfony/console based commands.

Why we do not agree with creating a new standard

standards xkcd

Image source https://xkcd.com/927/

Defining a new way of doing things is not necessary when there is a well accepted and defined standard provided and supported by the community. You can read the symfony/console component documentation Creating a basic Command, to learn about how to create command classes.

Drupal Console uses that standard, which has been tested for years and it is been widely supported by the Symfony and PHP communities. Here is a small list as example of CLI tools that uses symfony/console component:

For a full list of projects using symfony/console components, visit the official site.

By embracing Symfony standards, we’re fully participating in the PHP community, building bridges and encouraging Symfony community to join the Drupal project and allow us to reduce the isolation of Drupal, which allow new developers that have experience with symfony/console project to easily contribute to Drupal CLI projects.

On the other hand, creating a new "Drupal" way of writing commands as proposed by the Drush team will have the opposite effect and will further alienate the community. Creating a new Drupalism for writing CLI commands also introduces a new learning curve and technical debt including standards maintenance.

We should embrace and collaborate with existing communities and take advantage of the ability to "learn once, apply everywhere".

The issue is not the introduction of annotations

We have been discussing the usage of annotation long time ago, as you can follow on this issue Use annotations in Commands and the related pull request Annotations in Drupal Commands.

The Drupal Console team proposal for using annotation was to define any Drupal only feature.

Our proposal for a Drush and Drupal Console collaboration

There was a previous effort to work together in the pull request "Call Drupal Console commands natively from Drush", but still not yet merged, unfortunately, this never got much attention and Drush team instead decided to work on a new pull request "Use Symfony Console application and annotation commands in Drush".

In terms of sharing efforts and collaboration, we are working in decoupling Drupal Console features as components. Some of the advantages of extracting code as libraries will be:

  • Isolate features to make packages small and easy to maintain.

  • Reuse components between different Drupal CLI projects to avoid duplicated code.

  • Provide functionality into packages outside of Drupal Console Core and Contrib modules.

  • Propose to upstream improved features to symfony/console component.

To conclude, the Drupal Console team is open to collaborate with the Drush team. We strongly believe in using the standards defined by the Symfony community. This will help us to reduce the isolation of Drupal Community and at the same time, we will be following the modern PHP practices which were introduced in Drupal 8.

Related articles:

Thanks to everyone that help us reviewing and fixing this article.