Drush 15: The Doctor will see you now

A stethoscope draped over a terminal running dr deploy

Drupal 11.4+ comes with a Symfony Console application called Doctor 🩺. You run it by calling vendor/bin/dr. Doctor is a small but mighty application, offering a few commands like cron and install. I have been contributing commands to Doctor - alas the core review and merge process can be slow. Many vital commands are not in Drupal core yet. So, Drush is throwing its full weight behind Doctor and making nearly all of its commands available to dr. After you composer require drush/drush ^15 into your project, you can call dr deploy, dr updatedb, and most of your Drush friends.

dr list on Drupal 12 with Drush 15

What’s gone

Drush 15 (docs) only provides commands to dr. It no longer has:

  • Site aliases. dr doesn’t natively run commands on remote hosts. Consider host-specific programs like lagoon or acli or terminus. Also see PSSH or Fabric.
  • Config files (drush.yml). Consider Composer scripts or Task.
  • The drush entrypoint. Call Drupal’s dr instead.
  • Discovery of Drush-style commands in custom and contrib modules.
  • Commands that were lightly used/maintained: archive:*, locale:*, language:*, migrate:*, generate, core:rsync, sql:sync, field:*, twig:*, views:*, yaml:*.

Since Drush 15.x is compatible with Drupal 11.5+, you may “pre-upgrade” before upgrading to Drupal 12. You may have to port a couple contrib/custom commands since Drush won’t discover them anymore (see below). The Drush 14.x branch is unsupported and will not be released. It is available for sites that really want to upgrade to Drupal 12 and keep discovery of contrib/custom Drush commands. Once the upgrade is complete, consider upgrading to Drush 15 to regain support.

Porting commands

Drush’s abdication makes Doctor the sole focus of contrib and custom command porting efforts.

Use the Drush and Drupal docs to port a core or contrib Drush command. Or feed this prompt to your agent: Port this Drush command to a plain Symfony Console command that Drupal’s dr loads. Once ported, your command works on Drupal 11.4+. To preserve compatibility with Drush users, you can usually thinly extend the class you just authored. Put that thin class in the same place your old command lived. Drush 13 knows how to load the plain Console commandfile. For an example, see this Devel MR. If you are porting a contrib module (as opposed to custom), be sure to share your port with the project to speed up everyone else’s Drupal upgrade.

Helping Doctor

You can help Doctor by reviewing issues in the CLI subsystem. Please review generously and if you call for a change, create/update the MR at the same time. Contrary to popular belief, this does not make you ineligible to mark the issue RTBC. The spirit of that guideline is that more than one person should approve of a change before it is marked RTBC. Your review is that second person.

If you have thoughts about this effort, let’s discuss in #drush on Drupal Slack, or in the Drush issue queue.

We are pretty far along in Drush’s final act. It’s a gratifying feeling for Drupal core to finally gain a full featured CLI.