Answers.Body: <p>My experience with anything composer-ish seems to be:</p>
  
  <ol>
  <li>Struggle with it for a while until the site becomes messed up beyond repair.</li>
  <li>Restore from backup and struggle some more until it's messed up again.</li>
  <li>Create a brand new install and then copy over the sites/default folder and .htaccess and such.</li>
  <li>Replace the database with my backup.</li>
  <li>Run the upgrades.</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T19:33:07.930Z
Answers.Text: 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.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-18T20:39:06.483Z
Answers.Text: I had a literal laugh out lout moment at this.
Answers.UserDisplayName: David Hayes
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-02T14:37:26.697Z
Answers.Text: More than two years later and still the most relevant answer to anything composer related. Kudos D.  ;-)
Answers.UserDisplayName: CiviTeacher
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T00:15:52.737Z
Answers.LastActivityDate: 2019-12-04T00:15:52.737Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>In practice it's as simple as doing a <code>composer update</code> 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:</p>
  
  <ol>
  <li><p>You should declare both <code>civicrm-core</code> and <code>civicrm-drupal-8</code> in your composer json file. In the require section you should have something that looks like this:</p>
  
  
  
  <pre><code>"civicrm/civicrm-core": "^5.23",
  "civicrm/civicrm-drupal-8": "^5.23"
  </code></pre>
  
  <p><strong>Note:</strong> When upgrading to a new "minor" release of CiviCRM you should change your version constraints e.g. <code>"^5.24"</code> or to automatically get the latest CiviCRM stable version when you run <code>composer update</code> use <code>"^5"</code> as your version constraint.</p></li>
  <li><p>You should have the same version against both of these (^5.23 as an example.)</p></li>
  </ol>
  
  <p>You should install <a href="https://github.com/civicrm/cv" rel="nofollow noreferrer">CV</a> to manage database upgrades so that your upgrade process becomes the following commands (for the most part!):</p>
  
  <p><code>composer update &amp;&amp; cv up:db</code></p>
  
  <p>When using a composer-based workflow you can install CV using <code>composer require civicrm/cv</code> which will place the cv binary in <code>vendor/bin</code></p>
  
  <p>Note that using the <code>dev-master</code> version of <code>civicrm-drupal-8</code> has the potential to cause issues as it's developed alongside <code>civicrm-core</code> - you should use the same version number as you use for <code>civicrm-core</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T19:30:02.377Z
Answers.Text: 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).
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T20:08:32.933Z
Answers.Text: 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!
Answers.UserDisplayName: HomoTechsual
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-06T19:26:29.730Z
Answers.Text: 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!
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-27T16:52:00.680Z
Answers.Text: What does it mean to "declare" civicrm-core and civicrm-drupal-8 in your composer.json file? Can you please provide code examples?
Answers.UserDisplayName: CiviTeacher
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-27T20:53:09.347Z
Answers.Text: I've added an example.
Answers.UserDisplayName: HomoTechsual
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T21:23:22.503Z
Answers.Text: Is editing composer.json+`composer update` the same as `composer require`? Or are they slightly different? I haven't used update in a while because it seemed like it would go and update things it shouldn't, but I might have been doing it wrong.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T23:20:00.533Z
Answers.Text: require fetches the latest version of the packages you’re asking it for (and updates your version constraint in composer.json) update gets the latest version your constraint allows - it won’t update composer.json but will update composer.lock
Answers.UserDisplayName: HomoTechsual
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T09:14:12.357Z
Answers.LastActivityDate: 2020-03-28T19:58:44.840Z
Answers.LastEditDate: 2020-03-28T19:58:44.840Z
Answers.UserDisplayName: HomoTechsual
Answers.Body: <p>I've been updating it using the following:</p>
  
  <ul>
  <li>composer require civicrm/civicrm-core</li>
  <li>composer civicrm</li>
  <li>cv upgrade:db</li>
  </ul>
  
  <p>That is after making a backup first.</p>
  
  <p>Has worked for my installation.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T19:35:04.467Z
Answers.Text: 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?
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T19:43:38.560Z
Answers.Text: 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.
Answers.UserDisplayName: Corey Brown
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T19:48:14.097Z
Answers.Text: 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.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T20:54:29.177Z
Answers.Text: 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.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-07T20:31:23.693Z
Answers.Text: 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?
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-04T18:37:33.577Z
Answers.LastActivityDate: 2019-12-04T18:37:33.577Z
Answers.UserDisplayName: Corey Brown
Body: <p>I've got CiviCRM installed and working with Drupal 8 using Composer via <a href="https://gitlab.com/roundearth/drupal-civicrm-project" rel="nofollow noreferrer">https://gitlab.com/roundearth/drupal-civicrm-project</a></p>
  <p>What I'm not clear on is how best to update CiviCRM using Composer. Is it as straightforward as runnning something like:</p>
  <pre><code>composer require roundearth/civicrm-composer-plugin civicrm/civicrm-drupal-8 civicrm/civicrm-core:5.19.3
  </code></pre>
  <p>I can't find any documentation on updating.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-04-25T15:04:43.353Z
Comments.Text: Thanks @Demerit. That about sums it, except in my case, there is one more step. 6. Repeat steps 1 to 5.
Comments.UserDisplayName: Coventure Joe
Tags: <upgrade><drupal-8><composer>
Title: How can I update CiviCRM installed with Drupal 8 using Composer?
ThreadText: # How can I update CiviCRM installed with Drupal 8 using Composer?
  
  (Asked by: username_0 on 2019-12-03)
  
  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.
  
  **Tags:** upgrade, drupal-8, composer
  
  > **Comments:**
  > **username_1**: Thanks @username_2. That about sums it, except in my case, there is one more step. 6. Repeat steps 1 to 5.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_7 on 2019-12-04. Score: 4 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_3**: 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?  
  > **username_7**: 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.  
  > **username_3**: 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.  
  > **username_2**: 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.  
  > **username_0**: 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?  
  
  ---
  
  ### Answer by username_2 on 2019-12-04. Score: 4
  
  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.
  
  > **Comments:**
  > **username_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.  
  > **username_4**: I had a literal laugh out lout moment at this.  
  > **username_5**: More than two years later and still the most relevant answer to anything composer related. Kudos D.  ;-)  
  
  ---
  
  ### Answer by username_6 on 2019-12-04. Score: 4
  
  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](https://github.com/civicrm/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`.
  
  > **Comments:**
  > **username_3**: 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).  
  > **username_6**: 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!  
  > **username_3**: 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!  
  > **username_5**: What does it mean to "declare" civicrm-core and civicrm-drupal-8 in your composer.json file? Can you please provide code examples?  
  > **username_6**: I've added an example.  
  > **username_2**: Is editing composer.json+`composer update` the same as `composer require`? Or are they slightly different? I haven't used update in a while because it seemed like it would go and update things it shouldn't, but I might have been doing it wrong.  
  > **username_6**: require fetches the latest version of the packages you’re asking it for (and updates your version constraint in composer.json) update gets the latest version your constraint allows - it won’t update composer.json but will update composer.lock  
  
  ---
  
  