News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Padraic Brady's Blog:
Zend Framework 2.0 Dependency Injection (Part 1)
October 05, 2011 @ 12:34:33

In a new post to his blog Padraic Brady takes a look at dependency injection in Zend Framework 2.0. In this first part, however, he introduces the concept of "dependency injection" and offers a few suggestions on its use and tools that can make it simpler.

If you've been watching the PHP weather vane (we call it Twitter for short), you may have noticed a shift in Symfony and Zend Framework. Version 2.0 of both web application frameworks feature Dependency Injection Containers (DICs) as the primary means of creating the objects (and even Controllers) your application will use. This is an interesting shift in a programming language that often stubbornly evaded adopting DICs to any great extent.

He introduces dependency injection (DI) as a method for "injecting" objects and configurations into other interfaces without any specific kind of relation between the two. Part of several DI implementations is a container that does some of the magic object creation for you. He applies this concept to a Zend Framework structure and talks briefly about why these containers are "the devil" because they (usually) add complexity where none is needed. He points out one container library, Pimple, that gets it right in his opinion - defining object creation as closures. In the next part of the series, he'll compare the Zend Framework's DI setup against Pimple (and Symfony's) implementations.

0 comments voice your opinion now!
dependency injection di zendframework pimple symfony configuration


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Action Helpers in Zend Framework

Marcelo Gornstein's Blog: Writing PHP applications with Doctrine2 as ORM and Ding as DI container

Richard Thomas' Blog: Solar Framework Shorts -The rabbit hole that is Solar.config.php

ThinkPHP Blog: Methods to Reduce the Load of Your Webserver by Caching Content

Zend Developer Zone: Announcing the February 2011 Zend Framework Bug-Hunt


Community Events





Don't see your event here?
Let us know!


community release interview framework update series composer version tool install introduction package security podcast library voicesoftheelephpant language opinion laravel symfony

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework