While I had some time, I thought I might create a post for some composer and drush commands that I use A LOT… just for a reference.
This list is for Drupal 8/Drush 9.
Command | What It Does |
---|---|
$ drush cr | Clears cache (duh; you use this 1239832 times a day) |
$ drush en coder | Enable a module (ex. coder) |
$ drush pmu coder | Disable a module (ex. coder) |
$ composer require drupal/coder | Install a module (ex. coder) |
$ composer remove drupal/coder | Uninstall a module (ex. coder); disable it first! |
$ composer require drupal/migrate_tools:4.0-beta2 | Install a specific version of a module (ex. migrate tools) |
$ drush sql-dump –-result-file=’/path/to/database/backup.sql’ | Get a database backup easy |
$ composer update | Update Drupal 8 core & modules |
$ drush updb | Update the database after a Drupal core and/or module update (duh; do this after you run composer update; same as going to update.php) |
$ drush status | Tells you important information such as Drupal version, Drush version, etc. |
$ drush sqlc | Get into the database (MySQL) easy |
$ drush uli | Get a temporary URL to log into the Drupal site to bypass password; good for when you lose your password or your account is locked out and you’re the admin |
$ drush sql-connect | The database connection string |
$ composer -V | The version of composer you’re running |
$ drush user-create janny_m –mail=”my_email@yahoo.com” –password=”my_p@ssword” | Create a user (janny_m) with email and password |
$ drush user-add-role “administrator” janny_m | Make a user an administrator |
$ sudo /usr/local/bin/composer self-update | Update composer |