Cms cheatsheet
Drupal 11 Cheatsheet
Create, configure, update and debug Drupal 11 sites with Composer and Drush.
Setup
- Create a new Drupal project — Create a Composer-managed project from the recommended template.
- Install Drush — Add Drush, the Drupal command-line tool, to the project.
- Install the site — Run the installer with the standard profile. Use a real database password.
- Check site status — Show the Drupal and PHP versions, database connection and paths.
- Get a one-time login link — Print a link that logs you in as user 1 without a password.
Cache and cron
- Rebuild the cache — Clear all caches. The first thing to try when a change doesn't show up.
- Run cron — Run Drupal's scheduled tasks.
- Read a state value — Read a value from the state system, for example when cron last ran.
Modules and themes
- Download a module — Add a contributed module to the project with Composer.
- Enable a module — Install a downloaded module on the site.
- Uninstall a module — Uninstall a module and remove its data.
- List enabled modules — Show the modules that are installed.
- Install a theme — Install a theme so it can be selected or set as default.
- Set the default theme — Make an installed theme the site's default.
Configuration management
- Export configuration — Write the site's configuration to files so it can be committed.
- Import configuration — Apply the configuration files to the site.
- See configuration differences — List configuration that differs between the files and the database.
- Read a configuration value — Print the site name and other settings.
- Change a configuration value — Change a setting, here the site name.
Updates
- Find outdated Drupal packages — List Drupal packages that have newer versions.
- Update Drupal core — Update core and its dependencies.
- Run database updates — Run pending update hooks after updating code.
- Run the deploy steps — Run database updates, import configuration and rebuild the cache in one go.
- Check for security updates — List installed packages that have security advisories.
Users
- Create a user — Create an account. Use a real password.
- Give a user a role — Add the content_editor role to a user.
- Reset a user's password — Set a new password for a user. Use a real password.
Database and debugging
- Back up the database — Write the database to a SQL file.
- Restore the database — Import a SQL file into the site's database.
- Run a SQL query — Run a query against the site's database.
- Show recent log messages — Print the latest entries from the database log.
- Follow the log — Stream new log messages as they arrive.
- Run PHP in Drupal — Evaluate PHP with Drupal bootstrapped.
- Generate a module skeleton — Interactively scaffold a custom module.
Related cheatsheets
- WordPress WP-CLI 2 cheatsheet — Install, configure, update and back up WordPress sites from the command line with WP-CLI 2.