the requirements for dependency injection

  1. Don’t create class instances in other classes (if they are dependencies) — pass them into the class from outside.
  2. Don’t type-hint concrete classes — create interfaces.

B logbook : PHP | Javascript | Laravel | CodeIgniter | VueJs | ReactJs | WordPress

Translate »