Inversion of Control Container for PHP? [closed]

2019-01-16 12:50发布

I am trying to code TDD style in PHP and one of my biggest stumbling blocks (other than lack of a decent IDE) is that I have to make my own hacked together IoC container just to inject all my mock objects properly.

Has anyone used an Ioc container in php? All I've been able to find is PHP IOC on the ever-annoying phpclasses.org and it seems to have almost no documentation and not much of a following.

7条回答
再贱就再见
2楼-- · 2019-01-16 13:55

I played with some DI Frameworks for PHP, but I haven't used one in production. Have some links:

  1. http://www.stubbles.net/ which I think is the oldest I tried
  2. http://php.xjconf.net/
  3. FLOW3 - I belive this one will become a very nice framework (its beta right now)

You mentioned you would use it for TDD - so maybe have a look at Dependency Injection for Unit Tests in PHP

查看更多
登录 后发表回答