开发者

Dependency Injection in PHP 5.3

开发者 https://www.devze.com 2023-01-31 05:11 出处:网络
I am trying to tidy up an application, and have m开发者_StackOverflowanually been doing Constructor Dependency Injection for a while.

I am trying to tidy up an application, and have m开发者_StackOverflowanually been doing Constructor Dependency Injection for a while.

This is a bit tedious, and I would like to start utilizing a Dependency Injection Container instead.

I am looking for an actively developed and maintained DI container. I have found Crafty as an alternative, which can wire together dependencies with XML, YAML, Arrays or programatically.

The DI container should not be tightly coupled with a full blown framework, we are looking for something simple and pluggable, with the least hassle possible.

Does anyone have a recommendation and why you chose the particular implementation? Thanks for reading.


Since people seem to like my comment, I post it as an answer. I do not have experience of it, but i know of Symfony Dependency Injection library. It should be decoupled from the rest of the framework and it seems to be pretty flexible. Check it out at Symfony Components.

I also think Substrate looks pretty good. According to the author, it also has production experience, which is always good.


Bucket seems to fit well with your requirements.


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

It's very easy to use, and it integrates with Zend Framework very well (if ever you are using it).

(disclaimer: I do work on this framework)

0

精彩评论

暂无评论...
验证码 换一张
取 消