Skip to content

Instantly share code, notes, and snippets.

@itinance
Created May 25, 2021 23:42
Show Gist options
  • Save itinance/36b31997f06aa4c4a2f99251a645a64c to your computer and use it in GitHub Desktop.
Save itinance/36b31997f06aa4c4a2f99251a645a64c to your computer and use it in GitHub Desktop.
What is composer doing here?

Doing stuff in a terminal:

mkdir test
cd test
php -d memory_limit=-1 /usr/local/bin/composer require sylius/sylius

The output contains the following lines:

  - Installing sonata-project/block-bundle (4.5.3): Extracting archive
  - Installing ramsey/uuid (3.9.3): Extracting archive
  - Installing polishsymfonycommunity/symfony-mocker-container (v1.0.4): Extracting archive
  - Installing php-http/guzzle6-adapter (v2.0.2): Extracting archive

As we can see here, a library called "ramsey/uuid" was installed with version 3.9.3

If we now require the same library again (for some reasons):

php -d memory_limit=-1 /usr/local/bin/composer require ramsey/uuid

This will give the following error:

Using version ^4.1 for ramsey/uuid
./composer.json has been updated
Running composer update ramsey/uuid
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - sylius/sylius is locked to version v1.9.0 and an update of this package was not requested.
    - sylius/sylius v1.9.0 requires ramsey/uuid ^3.9 -> found ramsey/uuid[3.9.0, 3.9.1, 3.9.2, 3.9.3] but it conflicts with your root composer.json require (^4.1).
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment