News Feed
Sections




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

Ibuildings Blog:
Dependency Injection and Zend Framework Controllers
July 28, 2008 @ 08:47:40

Ian Barber has written up a look at dependency injection as a part of the Zend Framework's controller functionality for the Ibuildings blog.

Among the standard object oriented principles is favouring composition over inheritance, and there are plenty of design patterns that work along this line. However, one of the most useful day-to-day facets of the idea doesn't seem to get a lot of attention from PHP developers, namely dependency injection.

The general idea is, that if your class depends on some other object, that object should be passed in rather than generated internally or retrieved via a global variable or singleton.

He shares few ideas on how you can use this method in the controller of a Zend Framework including the use of the Zend Registry and an Action Helper. Code snips are provided for reach to show you how it'd be done.

0 comments voice your opinion now!
dependency injection zendframework application controller


blog comments powered by Disqus

Similar Posts

Community News: Book Release: "Easy PHP Websites with the Zend Framework" (W. Jason Gilmore)

Till Klampaeckel's Blog: Iterating over a table (with Zend_Db_Table and Zend_Paginator)

Ahmed Shreef's Blog: Soap Web Services in PHP & hint on consuming from .Net

Daniel Krook\'s Blog: Public draft - Developing PHP Applications for IBM Data Servers

Liip Blog: Why a Project Switched from Google Search Appliance to Zend_Lucene


Community Events





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


api list interview symfony language framework community laravel package voicesoftheelephpant deployment library release opinion bugfix series podcast tips install introduction

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