控制容器的PHP反转? [英] Inversion of Control Container for PHP?

查看:119
本文介绍了控制容器的PHP反转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在PHP中编写TDD风格,而我最大的绊脚石之一(除了缺乏体面的IDE之外)是我必须自己篡改IoC容器,才能正确注入所有模拟对象。 / p>

有没有人在php中使用Ioc容器?我所能找到的是 PHP IOC上不断令人讨厌的phpclasses.org a>,它似乎几乎没有文档,也没有多少关注。

我使用了一些用于PHP的DI框架,但我还没有使用过生产。有一些链接:


  1. http:/ /www.stubbles.net/ 其中
    我认为是我尝试的最老的

  2. http://php.xjconf.net/

  3. FLOW3 - 我相信这一个将
    成为一个非常好的框架(它现在的
    beta)


    你提到你会将它用于TDD - 所以也许看看 PHP中单元测试的依赖注入


    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.

    解决方案

    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

    这篇关于控制容器的PHP反转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆