Dependency Injection in PHP 5.3

I’m trying to tidy up the application and for some time injected constructor dependencies.

This is a bit tedious, and I would like to start using the dependency injection container.

I am looking for an active and supported DI container. I found Crafty as an alternative that can bind dependencies with XML, YAML, arrays, or programmatically.

The DI container does not have to be tightly connected to the fully inflated frame, we are looking for something simple and plug-in, with the least problems.

Does anyone have a recommendation and why did you choose a specific implementation? Thank you for reading.

+4
source share
3 answers

Since people seem to like my comment, I am posting it as an answer. I have no experience with this, but I know the Symfony Dependency Injection library. It needs to be separated from the rest of the framework, and it looks pretty flexible. Check it out on Symfony Components .

I also think Substrate looks good. According to the author, he also has manufacturing experience, which is always good.

+5
source

Bucket seems to fit your requirements.

+1
source

You can also check PHP-DI , it includes dependency injection via annotations ( @Inject ) and minimal configuration .

It is very easy to use and integrates very well with the Zend Framework (if you use it).

(disclaimer: I am working on this structure)

0
source

Source: https://habr.com/ru/post/902462/


All Articles