Reference for writing clear PHP code
It is difficult to know when one's code is well written. There are recommendations for writing PHP code in the manual, from CS theories, peers review, and gut feeling. That makes a lot of rules.
The main goal of this document is to collect such rules, so as to have them all easy to read and select them for reviewing one's code. This is a reference document, in which anyone may look for ways to improve their code.
There are obviously a lot of rules. And probably some will be added soon.
- This is no ultimate coding standard : claiming that any code is 100% compatible with the current reference is futile. No medals are eventually distributed.
- Don't use them all : it would be difficult to apply them all at the same time in one code. This is because some rules generates too many observations (try to educate quotes), some may be contradictory.
- It is fine to hate some rules : this is a reference. Its first goal is to collect their rules, their description, their advantages and drawbacks. After this, you'll be able to adopt some of them. This also means that you will dislike some rules : this is OK.
Unless stated otherwise, all content is licensed under the Creative Commons Attribution License.
A copy of the license is included in the repository.
ClearPHP was originally written by Damien Seguy. The following people have contributed to this project:
- Derick Rethans (https://github.com/kitsched)
- fneuneu (https://github.com/Fneufneu)
- Gary Jones (https://github.com/GaryJones)
- Guillaume Deviart (https://github.com/GuillaumeDievart)
- MozMorris (https://github.com/MozMorris)
- Phil Sturgeon (https://github.com/philsturgeon)
- Victor Stanciu (https://github.com/victorstanciu)
- Juliette Reinders Folmer (https://github.com/jrfnl)
To propose a new rule :
- fork this repository, create a branch, checkout that branch, add the rule in
proposition
branch, push the branch to Github, and send a pull request - Join us on the mailing-list