PHP PSR PSR-1: Basic Coding Standard


Example

PSR-1 is an accepted recommendation and outlines a basic standard recommendation for how code should be written.

  • It outlines naming convetions for classes, methods and constants.
  • It makes adopting PSR-0 or PSR-4 recommendations a requirement.
  • It indicates which PHP tags to use: <?php and <?= but not <?.
  • It specifies what file encoding to use (UTF8).
  • It also states that files should either declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or execute logic with side effects and not define symbols, but do both.