PHP is a server side scripting language used to generate dynamic pages. In general we prefer the use of Laravel as an MVC framework for PHP projects.
Unless otherwise specified, follow the guidelines in the PHP Standards Recommendations. Particular attention should be given to PSR-1 (Basic Coding Standard) and PSR-12 (Coding Style Guide).
Some frameworks have adopted variations to the standards set by the PSRs, these are covered in brief below. But the key requirement is for a project to be internally consistent. If possible, the use of automation and tooling to enforce standards should be implemented. The standard way to achieve this with PHP is to use CodeSniffer, and rule-sets for this tool are available to cover the PSR rules and variations.
camelCase
for functions and methodsUpperCamelCase
for Class namesCAPITALS_WITH_UNDERSCORES
for constants.The Laravel Best Practice guide expands on the PSR standards for naming and coding, with useful tips and guidance for producing quality code, advice on tooling, and other great standard ways of working.
The Official WordPress Coding Standards diverge somewhat from the PSR guidance. If you're coding in WordPress it may be necessary to employ codesniffer and adopt the standards defined in the developer guide.