Context
I was working on the elasticms core bundle, at a moment in time I needed to a new common helper function. A couple of minute later the function was there, the common's PR ready to be reviewed and I came back to my initial core's PR.
The think is that the core doesn't have a direct dependency to the common bundle. It depends on the client helper bundle. Which client helper bundle depends on the common bundle.
Core bundle dependencies
The core bundle depends on client helper bundle via this rule:
...
"elasticms/client-helper-bundle": "^3.6",
...
If we check in the Client Helper bundle dependencies we find this rule:
...
"elasticms/common-bundle": "~1.8.0",
...
If I add a dependency to a branch in the core's composer.json
file, like this:
...
"elasticms/client-helper-bundle": "^3.6",
"elasticms/common-bundle": "dev-feat/command-get-array",
...
At composer update
I face this problem:
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- elasticms/client-helper-bundle[3.6.0, ..., 3.7.9] require elasticms/common-bundle ~1.8.0 -> found elasticms/common-bundle[1.8.0, ..., 1.8.81] but it conflicts with your root composer.json require (dev-feat/command-get-array).
- Root composer.json requires elasticms/client-helper-bundle ^3.6 -> satisfiable by elasticms/client-helper-bundle[3.6.0, ..., 3.7.9].
Solution
The idea is to add a dependency directly to the common bundle in the core bundle's composer.json
file.
But use a composer trick to make that branch acting like a released version of the common bundle:
...
"elasticms/client-helper-bundle": "^3.6",
"elasticms/common-bundle": "dev-feat/command-get-array as 1.8.81",
...
You can now run composer update.
Last posts
- Draw.io on a website
- Deploy elasticms on AWS
- Intégrer BOSA Accessibility Check dans un site web [Content in French]
- PHP - Convert Human Readable Size to Bytes
- Composer: How to use a specific branch acting like a specific revision in composer dependencies
- Stream a CSV from a JSON array
- Comment utiliser les commandes "locales" du skeleton [Content in French]
- How to extract data from a JsonMenuNestedEditorField
- Backup on AWS glacier
- Refer to environment variables in twig