Coding standards

All files have to be UTF-8 encoded, never use any other encoding.

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 use 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 notdisplay:block;)
  • End all lines with a semicolon
  • For multiple, comma-separated selectors, place each selector on its own line
  • Attribute selectors, like input[type="text"] should always wrap the attribute's value in double quotes, for consistency and safety.

TypeScript

We're using TypeScript for client-side code. Please follow the official TypeScript coding guidelines.