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/derickr)
- fneuneu (https://github.com/Fneufneu)
- Gary Jones (https://github.com/GaryJones)
- Guillaume Deviart (https://github.com/GuillaumeDievart)
- Dennis Meckel (https://github.com/Rayne)
- MozMorris (https://github.com/MozMorris)
- Phil Sturgeon (https://github.com/philsturgeon)
- Victor Stanciu (https://github.com/victorstanciu)
- Juliette Reinders Folmer (https://github.com/jrfnl)
- Aleksandr Yuriev (https://github.com/aleksandrzen)