Dependency injection in PHP5

Written by on May 25, 2006 in PHP5 Articles - 4 Comments

PHP Thinktank Blog have a very good article which point to the Dependency injection technique with PHP5. The dependency injection pattern is very common in the java world, what is called also the Inversion of Control Containers. The techniques that Tomas have implemented in Garden is very similar to the Spring framework, which would use XML definitions with syntax as similar as possible. Very interesting pattern for those working on large scale, and trust that PHP applications can be scalable, easily maintainable and designed well.

Several months ago I started using Spring Framework. That is how I faced the dependency injection. As my programming skills mostly originated from web development with PHP, I found out that I’ve missed a great technique, which is as usually common in Java land, but rare in PHP. I ended up with a research of dependency injection libraries for PHP. There was a port of Pico container by Pawel Kozlowski, who gave a talk on it recently, and that was almost it (some bright minds from #php.thinktank had their own solutions for that).

4 Comments on "Dependency injection in PHP5"

  1. Oliver Schlicht April 23, 2007 at 8:54 am · Reply

    Hey Hatem,
    just googled your post ;). After Tomas didn’t want to continue to implement Garden, we continued working on it, improved some things and extended functionality. If you’d like to take a look at ;)

  2. Ronny June 18, 2007 at 12:04 pm · Reply

    Hey Oliver,
    Just wanted to check out, but it seems not to exist anymore. Is garden discontinued?

  3. Antonio June 16, 2008 at 10:40 am · Reply

    A framework with a spring-style dependency injection: lionframework
    Take a look at

  4. July 6, 2008 at 9:51 am · Reply

    great artikel

Leave a Comment