Drush (the DRUpal SHell) is a command line interface for Drupal. It provides all sorts of commands for assisting in Drupal development, automating workflows and in general making it easier to script various parts of the Drupal workflow. Learning to use Drush and the commands that come with Drush core will help both site administrators and developers speed up their day-to-day Drupal work. It really is a handy tool for everyone, not just developers.
Developers can, and often do, author custom Drush commands. Whether that's to add command line access to contributed modules like Search API or Backup & Migrate, or for site-specific tasks. The powerful Drush command API allows you to focus on handling your custom logic, and letting Drush deal with common CLI tasks like collecting input from users, formatting output, and displaying help messages.
In this series we're going to learn about:
- Installing Drush, and using the built-in commands to speed up common Drupal development tasks
- How to use Drush with Bash scripts, or as part of a CI/CD process
- Where to put your custom Drush commands code so Drush can find them
- Speeding up development by using Drush to generate common boilerplate code for custom modules and themes
- How Drush commands collect options, arguments, and interactive user input and make it available to your custom code
- Formatting output for humans, and for piping to other applications
- How to alter existing Drush commands
The tutorials in this collection assume that you're comfortable navigating the command line and executing basic commands. The tutorials covering authoring custom Drush commands assume that you're comfortable with writing object-oriented PHP code that makes use of Drupal core APIs and services.
These tutorials were authored with help from Anna Mykhailova, amykhailova on Drupal.org. Anna is an Associate Director of Technology and certified Acquia Grand Master. She has extensive real-world experience using Drush to solve client's needs through her work as a developer.