Composer Plugin for local development
MIT License
A composer plugin that assists you with local dependencies.
Imagine the following: You are developing two packages, A and B. Package A depends on B. In your normal workflow you would push changes you did in package B to github. .... Then wait.... until changes are pushed to packagist and caches are refreshed. Now you can run composer update
in package A to get all the changes you did in package B. That's very ineffective, not only do you need to to push changes most importantly you need to wait for a change that is just a directory away. Here is a solution.
At best this plugin is installed globally, so go ahead:
$ composer global require 'gossi/composer-localdev-plugin=dev-master'
$ composer global update
The priority in this plugin lies in the truth that you shouldn't change your packages code, it should just work as expected when pushed to github and others want to consume it. You only describe your local development to composer and the rest is handled by this plugin. Open '~/.composer/config.json' and add the localdev
property to the root node:
{
"config": {
"localdev": {
"": ["/path/to/your/packages"],
"sümfony": "/path/to/sümfony",
"my/package": "/path/to/my/package"
}
}
}
As you can see, you can define three types of folder types:
my/pkg
it will look for it in /path/to/your/packages/my/pkg/
.sümfony/finda
it will look for it in /path/to/sümfony/finda/
.my/package
will find it at /path/to/my/package/
.For global and vendor packages you can give multiple paths by defining them as an array (see the difference between global and vendors paths in the example above - both are accepted).
The neat idea is, you don't need to change your workflow at all. If you now run composer install
or composer update
in one of your packages, those packages that are available locally (described in the global composer config.json) will be symlinked to their original location. You will see something like the notice.
=> Symlinked phootwork/lang from /path/to/phootwork/lang
At the moment, every package that can be found locally is symlinked no matter what. There must be something to control this, because sometimes you just want your package from packagist in the desired version number. Make your suggestions under Issue #3.
There are still some issues, that haven't been solved:
composer update
one more time to make them both work (See #1).Contributions are welcome, at best open an issue or add a comment to and existing one get the discussion going.