I have multiple apps which share some repos.
In my local dev environment I have symlinked those repos via
{
"repositories" : [
{
"type" : "path",
"url" : "../../selion/importbundle"
}
]
}
to my apps such that I can test repo changes instantly on all apps.
I run composer update locally push the app changes to a git repo and just install them on the server. but server side this is kind of annoying because
Is it possible to use path repos locally and vcs repos serverside?
I define both local and vcs repos in composer.json as follows:
"repositories": {
"local-libs": {
"type": "path",
"url": "../lib/*"
},
"vendor/foobar": {
"type": "vcs",
"url": "git@repository/url/to/foobar.git"
},
"vendor/bazqux": {
"type": "vcs",
"url": "git@repository/url/to/bazqux.git"
}
}
So, by default, composer reads dependencies from a local path. And then, before installing dependencies on staging, CI runs composer config repositories.local-libs --unset and composer picks up "vcs" ones.
I've had this same issue. It would be nice to have a repositories-dev like we have require-dev. You could leave your repositories section intact (i.e., pointing to the VCS) and then add an autoload-dev section that overrides its derived path:
"repositories" : [
{
"type" : "vcs",
"url" : "git.foo.com:/path/to/my/dependent/repo.git"
}
],
"autoload-dev": {
"psr-4": {
"My\\Dependent\\Repo\\": "/path/to/my/live/dev/install/of/this/repo"
}
}
So, composer install would pull the git repo of your library into vendor/ but then the autoloader would ignore it and use your live edits instead. Then when you deploy/build you do composer install --no-dev (which you should already be doing) and you'll get the git code. I'm not sure I'd recommend doing this unless you're the only person on the project though -- it would likely cause some issues with other developers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With