News Feed
Sections




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

Kevin Schroeder's Blog:
My first stab at the Dependency Injection Container in Zend Framework 2
March 09, 2012 @ 12:57:57

Kevin Schroeder has a new post to his blog about some of his first trials with the DI container that comes with the Zend Framework 2.

With beta 3 now being released I have started to spend some time getting used to the new MVC components and the architecture in general. I turns out that was too much. When I learn something new I like to start with something broken and fix it. [...] So since I already know how to use event managers the next most basic thing I needed to understand was Dependency Injection. It turned out that I was actually using Dependency Injection and just didn't know it.

He starts with the most basic setup - a "Di" container with one class, "Test", added to it. He also shows how to inject things into the class inside the container and how to use a "setter" inside the called class.

0 comments voice your opinion now!
dependency injection container zf2 zendframework2 example


blog comments powered by Disqus

Similar Posts

Mikko Koppanen's Blog: Trimming an image

Greg Beaver's Blog: Be careful of PEAR 1.4.4 and older installs when uninstalling a package

Kevin Schroeder's Blog: ZF2 Dependency Injection: Managing Configuration - Part 2

PHPMaster.com: Logging with PSR-3 to Improve Reusability

Mikko Koppanen's Blog: Creating a reflection


Community Events





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


community interview series conference version introduction threedevsandamaybe opinion podcast list framework composer api symfony configure unittest release voicesoftheelephpant language laravel

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