SOLID/readme.md

24 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2016-04-20 13:01:31 +00:00
## SOLID Principles Examples in PHP
### Single Responsibility Principle ([Example](./1-single-responsibility-principle.php))
This principle is about **actors and high level architecture**.
> A class should have one, and only one, reason to change.
2016-04-20 13:01:31 +00:00
### Open Closed Principle ([Example](./2-open-closed-principle.php))
This principle is about **class design and feature extensions**.
> A class should be open for extension, but closed for modification.
2016-04-20 13:01:31 +00:00
### Liskov Substitution Principle ([Example](./3-liskov-substitution-principle.php))
This principle is about **subtyping and inheritance**
> Derived classes must be substitutable for their base classes.
2016-04-20 13:01:31 +00:00
### Interface Segregation Principle ([Example](./4-interface-segregation-principle.php))
This principle is about **business logic to clients communication**.
> Many client-specific interfaces are better than one general-purpose interface.
2016-04-20 13:01:31 +00:00
### Dependency Inversion Principle ([Example](./5-dependency-inversion-principle.php))
2018-10-01 09:47:11 +00:00
This principle wires up all **other four principles in a single circle**.
> Depend upon abstractions. Do not depend upon concretions.
2016-04-20 13:01:31 +00:00
#### For more information about *Object Oriented Design Principles*, you can refer [this slide](https://viblo.asia/thangtd90/posts/pVYRPJPmG4ng)