Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does 'dependency injection' solve in PHP? [duplicate]

Possible Duplicate:
What is dependency injection?

What is the hipe around 'dependency injection' adapted from Java and introduced in Symfony 2? Could someone give an example of a problem and a solution with and without a dependency injection?

like image 805
Dziamid Avatar asked Jun 17 '26 00:06

Dziamid


1 Answers

Explanation that fits to PHP: http://fabien.potencier.org/article/11/what-is-dependency-injection

BTW: It's not from Java world only. DI and variations of DIC are used in most of high level programming languages. It's an universal practice helping you to write more maintanable code.

like image 87
Jakub Zalas Avatar answered Jun 19 '26 18:06

Jakub Zalas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!