Back to top - »
- » Home
- » Coding Guidelines
PHP Coding Guidelines
- Settings for PHPStorm are stored in git in the root directory as PHPStormCodeStyle.xml and can be imported into PHPStorm to automatically configure your editor.
- Code should use tabs for indenting, not spaces.
- Hard wrap after 500, but try to keep comments formatted so they are readable in the editor with soft wrapping as needed.
- Function names should use camel case.
- Property names should use camel case.
- Table names in the database should be all lower case with underscores separating words.
- Arrays should be constructed using square brackets rather than array(...)
- Opening brackets for functions should be on the same line as the function name with a space after the function parameters.
- Opening brackets for class declartions should be on the same line as the class name.
- If there are empty functions / methods, place the braces on one line
- else should be on it's own line
- No single line if statements without braces
- for & foreach statements should use braces
- while statements should use braces
Change History
- Updated 2024-06-07 MDN - ByWater Solutions