mirror of
https://github.com/wataridori/solid-php-example.git
synced 2025-01-09 01:10:44 +00:00
19 lines
919 B
Markdown
19 lines
919 B
Markdown
|
## SOLID Principles Examples in PHP
|
||
|
|
||
|
### Single Responsibility Principle
|
||
|
A class should have one, and only one, reason to change. [Example](./1-single-responsibility-principle.php)
|
||
|
|
||
|
### Open Closed Principle
|
||
|
A class should be open for extension, but closed for modification. [Example](./2-open-closed-principle.php)
|
||
|
|
||
|
### Liskov Substitution Principle
|
||
|
Derived classes must be substitutable for their base classes. [Example](./3-liskov-substitution-principle.php)
|
||
|
|
||
|
### Interface Segregation Principle
|
||
|
Many client-specific interfaces are better than one general-purpose interface. [Example](./4-interface-segregation-principle.php)
|
||
|
|
||
|
### Dependency Inversion Principle
|
||
|
Depend upon abstractions. Do not depend upon concretions. [Example](./5-dependency-inversion-principle.php)
|
||
|
|
||
|
#### For more information about *Object Oriented Design Principles*, you can refer [this slide](https://viblo.asia/thangtd90/posts/pVYRPJPmG4ng)
|