I've been studying dependency injection for a while. I think I've finally collected enough data points to begin constructing my own dependency injection container.

I'm going to attempt to do this step by step in this thread.

My first checkin defines a simple interfaces for the "new instance" capability by using the __call magic method. The function name corresponds to the class name. So, to create class Foo, with a parameter of 'hello', you can use:
PHP Code:
$registry = new WactRegistry();
$obj $registry->Foo("hello"); 
This is the equivalent of
PHP Code:
$obj = new Foo("hello"); 
So what good is that? Well, if you leave off required parameters, the container will attempt to instantiate the necessary objects as best it can.
PHP Code:
class Cache {}
FeedFetcher {
__construct(Cache $cache) {}

$registry = new WactRegistry();
$obj $registry->FeedFetcher(); // a Cache is automatically created and passed 
Aha! Our first meager feature.

The Code:

I've been kind of busy lately, having only an hour or two each night to work on this. I suspect (hope and fear) that discussion in this thread may outpace me.