-
-
Save chartjes/cd677549534138d02d25 to your computer and use it in GitHub Desktop.
I have an app that is using 5 different packages that are available via our own local Satis repo. | |
I have one main repo that has a composer.json file that installs the 5 packages. However, I need | |
to keep working on code in those individual packages (which are now installed in <main repo>/vendor and | |
grouped under company name: | |
ie | |
vendor/company/package-1/ | |
vendor/company/package-2/ | |
What is the best way to make this workable to allow easy development work? |
Use --prefer-source
when composer install
'ing them. You can then cd
into the individual package directories under vendor/
, modify as needed, then commit directly from there.
Pretty much the same way you work with any external dependency that is under active development:
- use fuzzy selectors, like
~1.3
that will install any1.3.x
version, preferably the latests. - tag your dependencies, every time you want your changes to be propagated to your main app. If tagging is cumbersome, just use
dev-master
as your version constraint.
Bonus:
Composer is able to install these dependencies using git clone
(using --prefer-dist
) instead of downloading a simple gz
file. This way you can update your dependency local code, commit and push it (and tag it), then run php composer.phar update my/dependency
and ensure everything is working fine.
if you use --prefer-source, they get checkout out via git/svn, so you can commit from them. But you need to be careful, I heard from cases, where the changes got discarded trough execution of composer update, even if you dont continue when get asked
Clone the packages somewhere, create a dev/feature branch, work on them on their own, push changes & reference the repo+branch instead of statis+version in your composer.json
https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository