I have multiple development environments, one of which locally contains the source code for my packages, the other one doesn't. I'd like to keep my environments configured separately, but I'd also like composer to know that it should use my local package when present, and use the packagist version as a fallback.
I tried looking for this sort of thing online, but I couldn't find a direct answer. I already know how to require a local package, but I don't know how to optionally require a local package.
Just to reiterate, I want to require my package like so:
"require": {
"php": "^7.1.3",
/* ... */
"my-namespace/my-package": "dev-master",
},
And be able to list this package somehow as sometimes being locally available. If I do this:
"repositories": [
{
"type": "path",
"url": "./path/to/my/package"
},
]
I can make it locally required, but this means in my other development environment (where the package does not locally exist, nor do I want it to), composer will fail to require my package.
Once this is said and done, I'd like my local environment (the one with my packages locally hosted) to require the local version of the package, and I'd like my other environment (the one without my packages locally hosted) to require the packagist version of the package.
Any ideas?