Inversion of Control Container for PHP?(PHP的控制容器反转?)
问题描述
我正在尝试用 PHP 编写 TDD 样式,而我最大的绊脚石之一(除了缺乏像样的 IDE)是我必须制作自己的 IoC 容器,才能正确注入所有模拟对象.
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.
有人在 PHP 中使用过 Ioc 容器吗?我所能找到的只是 PHP IOC on the ever-annoying phpclasses.org 而且它似乎几乎没有文档,也没有太多的追随者.
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.
推荐答案
我玩过一些 PHP 的 DI 框架,但我没有在生产中使用过.有一些链接:
I played with some DI Frameworks for PHP, but I haven't used one in production. Have some links:
- http://www.stubbles.net/ 其中我认为是我尝试过的最老的
- http://php.xjconf.net/
- FLOW3 - 我相信这个会成为一个非常好的框架(它的测试版)
- http://www.stubbles.net/ which I think is the oldest I tried
- http://php.xjconf.net/
- FLOW3 - I belive this one will become a very nice framework (its beta right now)
你提到你会将它用于 TDD - 所以也许看看 PHP 中单元测试的依赖注入
You mentioned you would use it for TDD - so maybe have a look at Dependency Injection for Unit Tests in PHP
这篇关于PHP的控制容器反转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP的控制容器反转?
基础教程推荐
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
