0

I have following in my composer.json

{
  "require": {
       "vendor/package": "^2.0.0", // but installed 2.1.1 because of the ^
   }
}

how do I update/sync the composer.json from composer.lock to have the latest installed/exact version "vendor/package": "^2.1.1" I also have quite a few packages, updating it by hand is tedious.

Shobi
  • 10,374
  • 6
  • 46
  • 82
  • 1
    What do you want to achieve? Could `composer bump` help? – Nico Haase Apr 17 '23 at 15:37
  • 1
    Maybe https://stackoverflow.com/questions/45197446/how-to-get-composer-to-update-version-numbers-to-the-latest-ones-available-in-co helps to resolve your problem? – Nico Haase Apr 17 '23 at 15:38
  • `composer bump` was the answer I was looking for – Shobi Apr 17 '23 at 23:35
  • You can use `composer bump`, as said, but you don't normally need it. `composer.lock` alone is what provides the feature to set a specific version. Updating `composer.json` just means that you're declaring that any other version (e.g. 2.1.0) will not work. Since that's often not true, it can be confusing for your colleagues and your future self. – Álvaro González Apr 18 '23 at 10:35

0 Answers0