PHP 7 and PHP 8
We're using the PSR coding standards for phpMyFAQ. You can find the definition of these coding standards here:
HTML5
- We use the HTML5 doctype, which is easy to remember: <!DOCTYPE html>
- Two spaces for indentation, never tabs
- Double quotes only, never single quotes
- Always use proper indentation
- Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags)
- Paragraphs of text should always be placed in a <p> tag. Never use multiple <br/> tags.
- Every form input that has text attached should utilize a <label> tag, especially radio or checkbox elements.
- Always put quotes around attributes for readability.
CSS / SCSS
- Two spaces for indentation, never tabs
- Multiple-line approach (one property and value per line)
- Always a space after a property's colon (.e.g, display: block; and not display:block;)
- End all lines with a semi-colon
- For multiple, comma-separated selectors, place each selector on it's own line
- Attribute selectors, like input[type="text"] should always wrap the attribute's value in double quotes, for consistency and safety (see this blog post on unquoted attribute values that can lead to XSS attacks).
JavaScript / ECMAScript
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}