Update third-party composer package in your project
Sometimes you encounter some issue or would like to add some feature to the open source package you use in your project. And it useful enough to be contributed to the original package. Or you fixed some bug and want to share it with package maintainer.
It is much better to fork the package, switch composer to your fork, fix the bug and contribute it back on github.
So the steps are:
Just go to the package github page and press button "Fork". As a result you will have a copy of the original package in your account, like a this https://github.com/cmyker/PACKAGE
At this stage I replace original package in vendor directory with symlink to my cloned fork, change or fix something, and once it ready to be published I do the following
The best way (and usually the only way) to do this is to fork the package on github and send the pull request. But what if your application can't work without this fix?
The simplest way to resolve this matter is to move package from vendor to your project and maintain it there. But this approach has a few flaws - it is quite hard to keep library up to date with original and not so easy to contribute to the package.It is much better to fork the package, switch composer to your fork, fix the bug and contribute it back on github.
So the steps are:
Fork the package on github
Just go to the package github page and press button "Fork". As a result you will have a copy of the original package in your account, like a this https://github.com/cmyker/PACKAGE
Clone forked repository somewhere
git clone git@github.com:cmyker/PACKAGE.git
Add original package repository as upstream
git remote add upstream https://github.com/AUTHOR/PACKAGE.git
git fetch upstream
Update your fork if it is behind
git fetch upstream git merge upstream/master
Comments
Post a Comment