Repository navigation
Coding Style Standards
irinafrazao edited this page Mar 4, 2018
·
5 revisions
Overview of the PHP coding style used in this project:
- Every PHP files starts with a <?php tag.
- No closing ?> tag.
- Code indentation uses tabs.
- No hard limit on line length.
- A new blank line is inserted after the namespace line and the imports block (all use keywords) for readability.
- No unused imports should be left behind.
- Class names must be declared in StudlyCaps.
- Method names must be declared in camelCase().
- When possible, use the default controller method names (index, create, store, show, edit, update and destroy)
- No empty pre-generated method should be left behind for nothing.
- The opening brace goes on the next line for all methods and classes.
- The opening brace goes on the same line for logic statements.
- Comments should be added at the start of code block to explain the general purpose of that piece of code.
- Test functions must have a comment before it explaining what it is testing.
Overview of the HTML coding style used in this project:
- Start file by declaring document type with .
- Files should have html tags after the document type.
- Common parts of the page like header, footer and sidebar should be extracted in their own file and included when needed.
- Javascript methods should be in an external file and included in the HTML.
- Most css should be in an external file and included in the HTML.
- All HTML elements should be lowercase.
- All opening HTML elements should have a closing element.
- Element attributes should be lowercase.
- Attribute values should use double quotes ""
- Use blank lines to separate logical code blocks.
- Code indentation uses tabs.
- Comments should be added at the start of code block to explain the general purpose of that piece of code.