A short guide to contributing to the Droid PHP project.
Droid comprises a number of packages. Development takes place in a number of git repositories, hosted at GitHub.
Please consider reporting problems and defects in any of the Droid packages. First, identify the repository corresponding to the defective package and search the "Issues" to see if the particular problem has already been reported. If an an existing Issue already covers the problem, please add any further information that will help with diagnosis or correction.
When an existing Issue cannot be found for a particular problem, please create a new one and observe the following recommendations:-
composer show droid\*
and composer show symfony\*
.A patch to fix a defect is welcome; please see the next section for guidance on patch submissions.
Making a Pull Request (see below) to provide a fix for a bug is preferred, but a patch is always welcome too. Attach a patch to an existing Issue if one already describes the problem addressed by the patch; otherwise, please create a new Issue (see above) and attach the patch to it.
To create a patch:-
Clone the relevant repository, using git clone
, for example:-
$ git clone https://github.com/droid-php/droid.git
Install any dependencies, including those meant for use during development,
using composer install
, for example:-
$ cd droid && composer install
Make the necessary fix. Please follow the recommendations of the PSR-2 code style guide.
Run the PHPUnit test suite to ensure that the change doesn't introduce a further bug:-
$ cd droid && phpunit
Create the patch, for example:
$ git diff > fix-something.patch
or, when the change involves adding or removing files:-
$ git add <files> # and/or git rm <files>
$ git diff --cached > fix-something.patch
Submitting a Pull Request (PR) is the best way to contribute a bug fix or feature. To obtain the code and work on the fix or feature:-
Head to GitHub and fork the relevant repository and clone the fork:-
$ git clone git@github.com:myname/droid
Track the relevant repository by adding a git-remote, for example, to refer to the repository as "upstream":-
$ cd droid && git remote add upstream git@github.com:droid-php/droid
Create a topic branch on which to work on the fix or feature:-
$ git checkout -b fix_something
Install any dependencies, including those meant for use during development,
using composer install
:-
$ composer install
Run the test suite:-
$ phpunit
Work on the fix or feature, adding unit tests and integration tests as appropriate.
Run the test suite and resolve any differences from the previous test result.
Commit the fix or feature. Please try to keep the scope of each commit as focused as possible and provide a commit message that includes sufficient detail that someone else will understand the change introduced.
Fetch and integrate any changes from the official repository before pushing changes back to the forked repository:-
$ git checkout master
$ git fetch upstream master
$ git merge --ff-only upstream/master
$ git checkout fix_something
$ git rebase master
Push to the forked repository:-
$ git push origin/fix_something
Happy Hacking!