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.
Phemto is being developed again, and looks quite promising IMHO.
A few other similar projects, that you might want to look at:
bucket (Disclaimer: I'm the principal author of this one)
The php-port of picocontainer, has been around for a long time. I don't think it's being actively deveoped any more, but on the other hand, I believe that it's quite stable. It's been a long time since I looked at it though.
A rather new project, I recently stumbled upon is Crafty. Not sure how many people uses it though.I'm also watching sphicy, which looks interesting.Laravel 4 has the best IoC and DI framework. if you dont mind using a framework the Laravel 4 is the way to go
You might also want to try Ding (http://marcelog.github.com/Ding) which is modeled after Spring(tm) for Java. It is a complete inversion of control and dependency injection container, which also supports AOP
PHP-DI is another dependency injection container.
It features dependency injection through annotations and minimal configuration, here is an example:
It's very easy to use, and it integrates with Zend Framework for example.
(yes I do work on this framework)
What about the Symfony Dependency Injection or the PHP 5.3+ equivalent component from the symfony 2.0 project.
I have been working on a PHP IoC/DI Container named Substrate for the last six months. It is still very much a work in progress but it has been deployed in production for a month and a half and has been working pretty well so far.
Substrate is inspired by Spring Framework, but written with the strengths and limitations of PHP in mind. The documentation is pretty minimal at this point, but there is some sample code, including a unit testing example. Is this something that you think you might be able to use for TDD?