DIP is a guide that:
but. High-level modules should not be dependent on low-level modules. Both should depend on abstractions.
B. Abstractions should not depend on details. Details should depend on abstractions.
This is true if the "modules" of the weather are actually classes, functions, modules (those that do not exist in php as such), traits, or something else.
So you can use DIP in PHP. In fact, you can use it in PHP without writing classes! You can manage dependencies between functions in the same way as for classes under DIP.
przemo_li
source share