On this page
Updating Modules and Themes using Composer
The recommended way to install and update Drupal 9 and 10 sites is using Composer.
People who are used to upgrading module with Drush should notice that from Drush 9 and forward, all the up commands pm-update, pm-updatecode and pm-updatestatus are deprecated. You have to use the corresponding Composer commands instead.
To update core, all outdated modules and theme, update the db, clear the cache:
composer update "drupal/*" --with-all-dependencies
drush updatedb
drush cache:rebuildTo update specific module or update things one at the time, see below.
List updates
Use Composer's built-in command for listing packages that have updates available:
composer outdated "drupal/*"You can get the same information with the Composer's show command.
List security updates
Checking the security status from Drupal.org has been removed from Drush. Instead you can use Composer to check for security related updates:
composer auditOlder versions of Drush supported checking for security updates:
drush pm:securityInstall updates
For a minor-version update to a given Drupal module/project, simply use the following:
composer update drupal/modulename --with-all-dependenciesTo preview the update, and show you what would happen, without actually changing anything, add --dry-run.
For a major-version upgrade (such as 1.x to 2.x), update alone isn't enough: you must instead require the new major version explicitly. Since major versions often introduce major changes, this would be an excellent time to visit the module/project to inspect its documentation and issue queue. Once you're confident that the upgrade is fully compatible with your site, use the following, substituting the new major version number as needed:
composer require drupal/modulename:^2.0Finally, run any database updates, rebuild the cache and export the potentially changed configurations, reviewing the changes via --diff:
drush updatedb
drush cache:rebuild
drush config:export --diffHelp improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.