16 April 2013
At my company, My C-Sense, we use Doctrine amongst other PHP frameworks and libraries. When we find bugs (or need new features), we contribute to the project through our open source initiative.
The problem is when we submit a pull request on Github, several months usually happen until our fix appears in a stable release.
To be able to enjoy our bugfixes immediately, here is our workflow:
- We fork the repository of the project to our organization account
- We commit and publish the bugfix in a branch of our repository
- We submit a Pull Request
- We override the dependency to the project with our version in Composer
Overriding a dependency is quite simple: just add your git repository in your
composer.json and require you branch.
But when we want to override, for example,
doctrine/common which is used by
doctrine/orm, then we have a problem:
doctrine/orm wants a stable version of
doctrine/common, it will conflict with your requirement to a dev branch.
The solution is to alias your dev branch to a stable release, and that is possible through the awesome “inline alias” functionality in Composer.