Skip to content

freelancerwebro/solid-principles-in-php

Repository files navigation

SOLID Principles in PHP

SOLID Principles coded in PHP scripting language.

  1. Single responsibility
  • a class or a module should have only a single responsibility
  • there should be only one reason to change a class or module
  1. Open/closed
  • classes, functions, modules should be open for extension, but closed for modification
  1. Liskov substitution
  • when extending a class, remember that you should be able to pass objects of the subclass in place of objects of the parent class without breaking the client code
  1. Interface segregation
  • classes that implement interfaces should not be forced to implement methods they do not use
  • it is better to have many small interfaces, rather than a few large interfaces
  1. Dependency inversion
  • high level objects should not depend on low level implementations. Both should depend on abstractions.
  • abstractions should not depend on details. Details should depend on abstractions.

Releases

No releases published

Packages

No packages published

Languages