|
|
|
|
|
by moritzwarhier
853 days ago
|
|
The discussion thread here may underrepresent OOP PHP.
Large software in PHP usually uses namespaces instead of declaring functions at the top-level scope.
And most projects except for legacy ones lean towards objects and classes over plain functions. Namespaces allow non-global functions without a wrapping class already, IIRC.
Looking up though, there seem to be special cases (legacy behavior, making everything at the top level global) when using namespaced files with include() statemtents, if I read the docs correctly. Dumping pure functions as static members into wrapper classes was not uncommon when I used PHP. But primarily, a lot of code was heavy on dependency injection and inversion of control, Symfony being the leader of this coding style maybe. TFA also seems to be about class-oriented programming, but not the heavy design-pattern style mentioned above. The linked TUI CLI parser looks like a nice and lean PHP OOP example. |
|