Solid PHP - solid principles in PHP
PHP code examples for the SOLID rules, referring to the blog post: Solid PHP - SOLID principles in PHP
Single responsibility principle (SRP)
There should never be more than one reason for a class to change.
Examples:
Open/closed principle (OCP)
Software entities ... should be open for extension, but closed for modification.
Examples:
Liskov substitution principle (LSP)
Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.
Examples:
Interface segregation principle (ISP)
Many client-specific interfaces are better than one general-purpose interface.
Examples:
Dependency inversion principle (DIP)
Depend upon abstractions, NOT concretions.