The Composer Path Repository
Last week I gave my Composer for corporate use presentation at the code.talks 15 conference im Hamburg. In the section of my talk where I highlight how to work on multiple packages the same time (e.g. two applications sharing the same core functionality) I pointed to the audience to path repository feature of Composer. Unfortunately right after my session I began to realize that this is indeed the best feature we have out there when it comes to working on multiple packages the same time and to avoid the Satis or ToranProxy round trip. This is how it works: Add the following lines to your root composer.json file:
{
"repositories": [
{
"type": "path",
"url": "../my-other-package"
}
]
}
Let's require the other package now:
composer.phar require mycompany/myotherpackage
What happened?
Composer created a symlink in the vendor folder letting mycompany/myotherpackage point to ../my-other-package. This means I can change the code in ../my-other-package and the changes are available instantly without pushing the code and letting Satis or ToranProxy pick up up the changes.
The only downside I see is that the defined path needs to be same across all machines. It would be nice to be able to access an environment variable or some other Composer config setting so that each developer would be able to place the directories wherever he wants to. Maybe it is time for me to hack together another PR for Composer ;)