2012年9月3日星期一

Gonzalo Ayuso: Dependency Injection Containers with PHP. When Pimple is not enough.


Gonzalo Ayuso has a new post talking about dependency injection today and proposes his own DIC solution (dependency injection container) "when Pimple is not enough".



Two months ago I wrote an article about Dependency Injection with PHP and Pimple. After the post I was speaking about it with a group of colleagues and someone threw a question: "What happens if your container grows up? Does Pimple scale well?" The answer is not so easy. Pimple is really simple and good for small projects, but it becomes a little mess when we need to scale.


His solution comes from the Symfony2 framework itself - using its DIC separately from the framework. He includes a configuration example and some simple classes that depend in each other. He also shows how to use imports in the config as well.

没有评论:

发表评论