blob: be776ec1fb66ff5c08b2ba557f845e5868c40b03 [file] [log] [blame]
Derek Jonesf3ab2572012-07-02 11:12:44 -07001###########################
2Contributing to CodeIgniter
3###########################
4
David Wosnitzace899c92014-12-14 07:25:01 +01005.. toctree::
6 :titlesonly:
7
8 ../documentation/index
9 ../DCO
10
Derek Jonesf3ab2572012-07-02 11:12:44 -070011CodeIgniter is a community driven project and accepts contributions of code
12and documentation from the community. These contributions are made in the form
Master Yodabd2a7e42015-03-25 02:36:31 -070013of Issues or `Pull Requests <https://help.github.com/articles/using-pull-requests/>`_
14on the `CodeIgniter repository <https://github.com/bcit-ci/CodeIgniter>`_ on GitHub.
Derek Jonesf3ab2572012-07-02 11:12:44 -070015
16Issues are a quick way to point out a bug. If you find a bug or documentation
17error in CodeIgniter then please check a few things first:
18
19- There is not already an open Issue
20- The issue has already been fixed (check the develop branch, or look for
21 closed Issues)
22- Is it something really obvious that you fix it yourself?
23
24Reporting issues is helpful but an even better approach is to send a Pull
25Request, which is done by "Forking" the main repository and committing to your
26own copy. This will require you to use the version control system called Git.
27
James L Parry9442ac42014-11-10 22:53:16 -080028*******
29Support
30*******
31
Andrey Andreev4bb2b952015-10-12 13:55:24 +030032Please note that GitHub is not for general support questions! If you are
33having trouble using a feature of CodeIgniter, ask for help on our
34`forums <http://forum.codeigniter.com/>`_ instead.
James L Parry9442ac42014-11-10 22:53:16 -080035
Andrey Andreev4bb2b952015-10-12 13:55:24 +030036If you are not sure whether you are using something correctly or if you
37have found a bug, again - please ask on the forums first.
James L Parry9442ac42014-11-10 22:53:16 -080038
Andrey Andreev4bb2b952015-10-12 13:55:24 +030039********
40Security
41********
42
43Did you find a security issue in CodeIgniter?
44
45Please *don't* disclose it publicly, but e-mail us at security@codeigniter.com,
46or report it via our page on `HackerOne <https://hackerone.com/codeigniter>`_.
47
48If you've found a critical vulnerability, we'd be happy to credit you in our
49`ChangeLog <../changelog>`.
James L Parry9442ac42014-11-10 22:53:16 -080050
James L Parry1a162f12014-11-24 00:51:13 -080051****************************
James L Parry9442ac42014-11-10 22:53:16 -080052Tips for a Good Issue Report
James L Parry1a162f12014-11-24 00:51:13 -080053****************************
James L Parry9442ac42014-11-10 22:53:16 -080054
55Use a descriptive subject line (eg parser library chokes on commas) rather than a vague one (eg. your code broke).
56
57Address a single issue in a report.
58
59Identify the CodeIgniter version (eg 3.0-develop) and the component if you know it (eg. parser library)
60
61Explain what you expected to happen, and what did happen.
62Include error messages and stacktrace, if any.
63
64Include short code segments if they help to explain.
65Use a pastebin or dropbox facility to include longer segments of code or screenshots - do not include them in the issue report itself.
66This means setting a reasonable expiry for those, until the issue is resolved or closed.
67
68If you know how to fix the issue, you can do so in your own fork & branch, and submit a pull request.
69The issue report information above should be part of that.
70
71If your issue report can describe the steps to reproduce the problem, that is great.
72If you can include a unit test that reproduces the problem, that is even better, as it gives whoever is fixing
73it a clearer target!
74
75
Derek Jonesf3ab2572012-07-02 11:12:44 -070076**********
77Guidelines
78**********
79
80Before we look into how, here are the guidelines. If your Pull Requests fail
81to pass these guidelines it will be declined and you will need to re-submit
82when you’ve made the changes. This might sound a bit tough, but it is required
83for us to maintain quality of the code-base.
84
85PHP Style
86=========
87
88All code must meet the `Style Guide
Andrey Andreevbd202c92016-01-11 12:50:18 +020089<https://codeigniter.com/userguide3/general/styleguide.html>`_, which is
Derek Jonesf3ab2572012-07-02 11:12:44 -070090essentially the `Allman indent style
Andrey Andreevbd202c92016-01-11 12:50:18 +020091<https://en.wikipedia.org/wiki/Indent_style#Allman_style>`_, underscores and
Derek Jonesf3ab2572012-07-02 11:12:44 -070092readable operators. This makes certain that all code is the same format as the
93existing code and means it will be as readable as possible.
94
95Documentation
96=============
97
98If you change anything that requires a change to documentation then you will
99need to add it. New classes, methods, parameters, changing default values, etc
100are all things that will require a change to documentation. The change-log
101must also be updated for every change. Also PHPDoc blocks must be maintained.
102
103Compatibility
104=============
105
Andrey Andreevbcfe4612016-07-26 20:34:30 +0300106CodeIgniter recommends PHP 5.6 or newer to be used, but it should be
107compatible with PHP 5.3.7 so all code supplied must stick to this
108requirement. If PHP 5.4 (and above) functions or features are used then
109there must be a fallback for PHP 5.3.7.
Derek Jonesf3ab2572012-07-02 11:12:44 -0700110
111Branching
112=========
113
114CodeIgniter uses the `Git-Flow
115<http://nvie.com/posts/a-successful-git-branching-model/>`_ branching model
116which requires all pull requests to be sent to the "develop" branch. This is
117where the next planned version will be developed. The "master" branch will
118always contain the latest stable version and is kept clean so a "hotfix" (e.g:
119an emergency security patch) can be applied to master to create a new version,
120without worrying about other features holding it up. For this reason all
121commits need to be made to "develop" and any sent to "master" will be closed
122automatically. If you have multiple changes to submit, please place all
123changes into their own branch on your fork.
124
125One thing at a time: A pull request should only contain one change. That does
126not mean only one commit, but one change - however many commits it took. The
127reason for this is that if you change X and Y but send a pull request for both
128at the same time, we might really want X but disagree with Y, meaning we
129cannot merge the request. Using the Git-Flow branching model you can create
130new branches for both of these features and send two requests.
131
132Signing
133=======
134You must sign your work, certifying that you either wrote the work or
135otherwise have the right to pass it on to an open source project. git makes
136this trivial as you merely have to use `--signoff` on your commits to your
137CodeIgniter fork.
138
139.. code-block:: bash
140
141 git commit --signoff
142
143or simply
144
145.. code-block:: bash
146
147 git commit -s
148
149This will sign your commits with the information setup in your git config, e.g.
150
151 Signed-off-by: John Q Public <john.public@example.com>
152
David Wosnitzace899c92014-12-14 07:25:01 +0100153If you are using Tower there is a "Sign-Off" checkbox in the commit window. You
154could even alias git commit to use the -s flag so you don’t have to think about
Derek Jonesf3ab2572012-07-02 11:12:44 -0700155it.
156
David Wosnitzace899c92014-12-14 07:25:01 +0100157By signing your work in this manner, you certify to a "Developer's Certificate
Andrey Andreev168c7212016-01-29 00:56:27 +0200158of Origin". The current version of this certificate is in the :doc:`/DCO` file
David Wosnitzace899c92014-12-14 07:25:01 +0100159in the root of this documentation.