PHP Best Practices

05 Apr 2018

Principles and rules

All code must follow:

Coding styles

Allowed:

if (count(stringVar) > 0)
if (empty(stringVar))

Not allowed:

if ($string)
if ($integer)
if ($object)

Naming things

doSomething()
getSomething()
deleteSomething()
clearSometing()

Common rules

Dependency injection

Controller/Action

Service

Repository

Method naming rules

Data Transfer Object (DTO)

Value Object

Parameter Object

Type Hinting

Tests

Version Control

Security

PHPStorm

Settings

Plugins