Search code examples
gitsymfonybundlecomposer-phpvendor

Maintainig very own vendor with composer and git Symfony2 Bundle


I created a vendor lib (Symfony2 Bundle) in git repository. Added composer.json to it.

In multiple projects I use it as a vendor (vcs in composer.json). Everything works fine unless I want to modify original bunlde/vendor.

I can't push to it directly from the projet, that uses the bundle. I have to clone bundle's repo in new dir, change it there and push. This isn't convinient as bundle doesn't work itself, so commits are kinda try-and-see-what-happens.

What would be the best practise to maintain my own vendor repo?


Solution

  • Provided your vendor is installed from source, you can modify and push it. To force installing from source, use the --prefer-source option:

    composer install/update --prefer-source
    

    Then cd to your vendor's directory and you'll see it's a separate git repo. You can do a pull in there to get the latest version, make a change and push it back.

    The same works for 3rd party bundles. In that case you just need to add a git remote to your fork to push to it.