Skip to content

Latest commit

 

History

History
49 lines (30 loc) · 1.13 KB

File metadata and controls

49 lines (30 loc) · 1.13 KB

PHP Style Guidelines

We should follow best practices accepted by the community. As mentioned in php the right way, PHP-FIG, the PHP Framework Interop Group, announced PSR.

We decided to follow PSR-2.

Operators

Starting from PHP 5.3, you can use ?: to simplify ternary operations. The two following statements are the same:

$otherVariable = $variable ?: $someVariable;

$otherVariable = $variable ? $variable : $someVariable;

Please read Global Styles for additional guidelines regarding operators

Naming

Variables

We use camelCase for variable names. The first letter should be lowercase.

No:

$variable_name

No:

$VariableName

Yes:

$variableName

Templates

Please read Template Guidelines