PSR-12 in Php

PSR-12 is a set of coding guidelines for PHP, published by the PHP Framework Interoperability Group (PHP-FIG). It is an extension of the PSR-1 basic coding standard, and provides additional guidelines for writing clean, organized, and maintainable PHP code.

Some of the key guidelines in PSR-12 include:

  • Use spaces, not tabs, for indentation
  • Use camelCase for variable and function names
  • Use snake_case for constants and file names
  • Use meaningful, descriptive names for variables, functions, and constants
  • Use proper documentation blocks for functions and classes
  • Use strict comparison operators (=== and !==) instead of loose comparison operators (== and !=)
  • Use PHP 7.0 syntax and features, where possible

Adhering to these guidelines can help make your PHP code more consistent and easier to read and understand for other developers.

Leave a Comment