I've got CiviCRM installed and working with Drupal 8 using Composer via https://gitlab.com/roundearth/drupal-civicrm-project

What I'm not clear on is how best to update CiviCRM using Composer. Is it as straightforward as runnning something like:

composer require roundearth/civicrm-composer-plugin civicrm/civicrm-drupal-8 civicrm/civicrm-core:5.19.3

I can't find any documentation on updating.

  • Thanks @Demerit. That about sums it, except in my case, there is one more step. 6. Repeat steps 1 to 5. Apr 25, 2023 at 15:04

3 Answers 3


I've been updating it using the following:

  • composer require civicrm/civicrm-core
  • composer civicrm
  • cv upgrade:db

That is after making a backup first.

Has worked for my installation.

  • You probably mean "composer update" in the second item, since "civicrm" is not a composer command. I'm not sure this adds anything new compared to the previous answer?
    – Alan Dixon
    Dec 4, 2019 at 19:35
  • I've been using 'composer civicrm' and it works. I can't for sure tell you what it's doing behind the scenes (more a site builder than a dev/sysadmin), but it's what was provided to me via our outside vendor. I'm sure it's not 100% correct (I recall being told this was going to change), but have never run into any issues. Dec 4, 2019 at 19:43
  • Try "composer help civicrm" and you'll see what it does (it says " Run all the tasks usually run after civicrm/civicrm-core is installed"). It looks like it will do the various non-composer-ish downloads after the composer update. So, yes, that looks like a good method.
    – Alan Dixon
    Dec 4, 2019 at 19:48
  • That's interesting. One of the (many) problems I often ran into was whatever is supposed to trigger the plugin to do its thing only seemed to fire on new installs or if I deleted folders first. So composer civicrm sounds like it might be useful.
    – Demerit
    Dec 4, 2019 at 20:54
  • This appeared to work for me (although I ran the database update via the front end). If I have the l10n localization files installed, how can I update those at the same time using composer?
    – Graham
    Dec 7, 2019 at 20:31

My experience with anything composer-ish seems to be:

  1. Struggle with it for a while until the site becomes messed up beyond repair.
  2. Restore from backup and struggle some more until it's messed up again.
  3. Create a brand new install and then copy over the sites/default folder and .htaccess and such.
  4. Replace the database with my backup.
  5. Run the upgrades.
  • 3
    Points for honesty and a useful warning. Composer tends to be too smart for my taste, hiding subtleties to be "simple" to use, but hard to figure out when what you want isn't what it wants. There is a --dry-run flag that should help you try things without breaking it immediately.
    – Alan Dixon
    Dec 4, 2019 at 19:33
  • I had a literal laugh out lout moment at this. Feb 18, 2020 at 20:39
  • 1
    More than two years later and still the most relevant answer to anything composer related. Kudos D. ;-) Aug 2, 2022 at 14:37

In practice it's as simple as doing a composer update for the most part - assuming you're configured "sensibly" - the RoundEarth setup makes (or at least made!) some assumptions re: versioning that are not helpful for upgrading. So here goes:

  1. You should declare both civicrm-core and civicrm-drupal-8 in your composer json file. In the require section you should have something that looks like this:

    "civicrm/civicrm-core": "^5.23",
    "civicrm/civicrm-drupal-8": "^5.23"

    Note: When upgrading to a new "minor" release of CiviCRM you should change your version constraints e.g. "^5.24" or to automatically get the latest CiviCRM stable version when you run composer update use "^5" as your version constraint.

  2. You should have the same version against both of these (^5.23 as an example.)

You should install CV to manage database upgrades so that your upgrade process becomes the following commands (for the most part!):

composer update && cv up:db

When using a composer-based workflow you can install CV using composer require civicrm/cv which will place the cv binary in vendor/bin

Note that using the dev-master version of civicrm-drupal-8 has the potential to cause issues as it's developed alongside civicrm-core - you should use the same version number as you use for civicrm-core.

  • 1
    You can set the specific civi version with e.g. "composer require --no-update civicrm-core:^5.19", before running the update. You can also use the ~5 version for civicrm-core and dev-master for civicrm-drupal-8 and then it will update to the latest stable. Note that for 5.19, you need to update the roundearth plugin first (leave it on dev-master).
    – Alan Dixon
    Dec 4, 2019 at 19:30
  • It's absolutely not recommended to use dev-master of civicrm-drupal-8 you should peg this to the same version as civicrm-core this has already caused issues and may do so again in future! Dec 4, 2019 at 20:08
  • Okay, thanks, will update my installs. Apropros of nothing, the Drupal composer installation seems to have changed slightly in the last days, but the CiviCRM install still worked!
    – Alan Dixon
    Dec 6, 2019 at 19:26
  • What does it mean to "declare" civicrm-core and civicrm-drupal-8 in your composer.json file? Can you please provide code examples? Mar 27, 2020 at 16:52
  • I've added an example. Mar 27, 2020 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.