News Feed
Sections




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

Josh Adell:
Migrating to Dependency Injection
November 23, 2012 @ 11:41:41

In a new post to his blog Josh Adell talks about his voyage to implement dependency injection into a current application. His work can be found in this github repository.

Recently, I gave a lunch-and-learn to my team on the topic of Dependency Injection (DI). Instead of showing a bunch of slides explaining what DI is and what it's good for, I created a small project and demonstrated the process of migrating a codebase that does not use DI to one that does. Each stage of the project is a different tag in the repository. The code can be found on Github: http://github.com/jadell/laldi. Checkout the code, and run composer install. To see the code at each step in the process, run the git checkout command in the header of each section.

He goes through each "checkout" step (the title is the git command to run to follow along) showing how he migrated away from a simple micro-framework based site to one that defines the various objects (and repositories) inside the "application" object. He adds in a few comments to let you know a bit more about what's going on and some basic event handling. He finishes off the post with some potential issues that could come up both during the process and with the resulting application.

0 comments voice your opinion now!
migrate dependency injection tutorial github


blog comments powered by Disqus

Similar Posts

Pádraic Brady's Blog:Doing that thing called PEAR - Packaging Source Code for PEAR Distribution

Grzegorz Godlewski's Blog: Automating software development and deployment

PHPMaster.com: Debugging PHP Code with FirePHP

ONLamp.com: Developing Web Services Using PHP

BillS' IIS Blog: How to install PHP on IIS7 (RC1)


Community Events

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


voicesoftheelephpant series podcast version extension language laravel5 introduction interview api security laravel library framework community unittest release opinion threedevsandamaybe symfony

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