TL;DR
There are the main approaches to using modern PHP: like Ruby or like Java. We prefer Java-way: less magic, more types.
We strive to minimize magic and help IDE and static code analyzers to help us.
We use PSR-12 extended by other rules (mostly by powerful Slevomat Coding Standard). Additionally, we like Spatie’s code guidelines and borrow some rules from them.
We generally observe the standards from the PHP FIG. We use automated tools to check our code on CI:
- Laravel Pint
- PHPStan
- PHPInsights
- and more...
Our codebase has some legacy code that do not fully follow our standards, please treat this document as the main source of truth. Main legacy parts:
Setters. We SHOULD use domain-specific methods to change model’s state.
