mirror of
https://github.com/wataridori/solid-php-example.git
synced 2024-12-12 14:17:54 +00:00
Some examples about SOLID Design Principles in PHP
.gitignore | ||
1-single-responsibility-principle.php | ||
2-open-closed-principle.php | ||
3-liskov-substitution-principle.php | ||
4-interface-segregation-principle.php | ||
5-dependency-inversion-principle.php | ||
LICENSE | ||
readme.md |
SOLID Principles Examples in PHP
Single Responsibility Principle (Example)
This principle is about actors and high level architecture.
A class should have one, and only one, reason to change.
Open Closed Principle (Example)
This principle is about class design and feature extensions.
A class should be open for extension, but closed for modification.
Liskov Substitution Principle (Example)
This principle is about subtyping and inheritance
Derived classes must be substitutable for their base classes.
Interface Segregation Principle (Example)
This principle is about business logic to clients communication.
Many client-specific interfaces are better than one general-purpose interface.
Dependency Inversion Principle (Example)
This principle wires up all other four principles in a single circle.
Depend upon abstractions. Do not depend upon concretions.