-
Notifications
You must be signed in to change notification settings - Fork 0
Coding Style
Sébastien Villemain edited this page Nov 9, 2018
·
12 revisions
A few words about the style and rules of development.
Rather than writing hundreds of lines on the standards, try to just soak in what already exists. Readability is important, but not doing too much is even more important.
Use the PHP Standards Recommendations.
As of 2014-10-21 PSR-0 has been marked as deprecated. PSR-4 is now recommended as an alternative.
Note 4.2. Properties : MUST be in camelCase.
Because it's good to do differently. 😁
- Do not use error control operator: the at
@
sign. Never use it. - Do not use
print()
.echo()
does it lighter. - Do not use
Global
. Global variables come with some special overhead. - Do not use double quoted syntax for Strings: the
"
sign. 99% of time, it is necessary to use the single quotation mark'
. - Do not use Superglobals. Use only CoreRequest.
- If you create a new folder, also create an index.html file.
- Put everything in lowercase
- Separate words with the underscore
- Put the names of the tables in the plural
- Avoid abbreviations
- Use the UTF-8 charset
- Use SQL constraints (FOREIGN KEY, REFERENCES, ...)