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. We've just published a whole new series of tutorials on Drush, representing a huge effort to bring our Drush content up-to-date.
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, Learn Drush: The Drupal Shell, 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 Mykhailove, 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.
- What Is Drush?
- Install Drush Using Composer
- Enable, Update, and Manage Modules and Themes with Drush
- Use Drush for Common Site and Environment Management Tasks
- Use Drush to Speed up Common Drupal Development Tasks
- Use Drush to Deploy Drupal Updates
- Overview: Drush's Output Formatting System
- Automating Drupal Tasks with Drush and Bash Scripts
- Drush Site Aliases
- Drush Configuration
- Develop Drupal Modules Faster with Drush Code Generators
- Scaffold a Custom Content Entity Type with Drush Generators
- Create a Custom Drush Code Generator
- Overview: Creating Your Own Custom Drush Commands
- Create a Custom Drush Command
- Use Command Line Arguments with a Custom Drush Command
- Add Options to a Custom Drush Command
- Add an Interactive Prompt to a Drush Command
- Logging and Error Handling in Drush Commands
- Create Site-Wide Custom Drush Commands
- Overview: Drush Hooks
- Alter an Existing Drush Command
We've been covering Drush for a long time and this new set of tutorials on Drush is a much-needed update. We'll be archiving our old Drush videos and directing folks to this new series of tutorials. While we update tutorials every week with minor fixes and updates, this represents a huge effort to bring tutorials on an important and popular topic into the present. We hope you'll dive into these new tutorials and let us know how they've helped you become a power Drupal admin!