Some examples about SOLID Design Principles in PHP
Go to file
Tran Duc Thang 442fea3e16
Add MIT License
2021-03-13 10:48:06 +07:00
.gitignore Init 2016-04-20 21:15:00 +07:00
1-single-responsibility-principle.php Init 2016-04-20 21:15:00 +07:00
2-open-closed-principle.php Init 2016-04-20 21:15:00 +07:00
3-liskov-substitution-principle.php Init 2016-04-20 21:15:00 +07:00
4-interface-segregation-principle.php Add canCode() in Workable 2018-01-19 15:03:24 +01:00
5-dependency-inversion-principle.php Init 2016-04-20 21:15:00 +07:00
LICENSE Add MIT License 2021-03-13 10:48:06 +07:00
readme.md Update Readme.md 2018-10-01 16:47:11 +07:00

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.

For more information about Object Oriented Design Principles, you can refer this slide