Here is the situation.
I'm developing package-a which depends on package-b. The latter is hosted on bitbucket:
projects/
├── package-a/
├── package-b/
I need to make changes to package-b and see the results without pushing the code and do a composer update
. Then, when finishing the work, I'll push a new tag and deploy package-a to the production server.
So I ended up using composer-merge-pluging and Composer path repositories, with the following configuration:
Here is the composer.json
of package-a:
{
"name": "my/package-a",
"require": {
"my/package-b": "^1.0"
},
"repositories": [
{
"type": "vcs",
"url": "[email protected]:my/package-b.git"
}
],
"extra": {
"merge-plugin": {
"include": [
"composer.local.json"
]
},
"replace": true
}
}
This file will include composer.local.json
(only in my local machine! this file is not committed nor pushed to the production server), where I'm saying "use the dev-master version and the path repository":
{
"require": {
"my/package-b": "dev-master"
},
"repositories": [
{
"type": "path",
"url": "../package-b"
}
]
}
The setup is fine in the sense that if I run composer install
from package-a then package-b is symlinked and I can work directly on it.
But when I deploy package-a to my server using Deployer (versioning the composer.lock
file too) it does a composer install
but lock file contains a reference to package-b@dev-master using the path repository (and this is wrong).
Any idea how to solve this problem? I'm sure it's a common one but I can't get it.