<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 23 May 2013 02:40:54 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Jeune Asuncion: ZF1.11 + Doctrine 2 + Symfony DI Integration]]></title>
      <guid>http://www.phpdeveloper.org/news/18391</guid>
      <link>http://www.phpdeveloper.org/news/18391</link>
      <description><![CDATA[<p>
In <a href="http://jeunito.me/zf1-11-doctrine-2-symfony-di-integration/">this new post</a> to his site <i>Jeune Asuncion</i> shows how he integrated several technologies to make for a robust system - Zend Framework (1.11), Doctrine 2 and the Symfony dependency injection system.
</p>
<blockquote>
Last week, <a href="http://jeunito.me/choosing-a-new-framework/">I blogged about looking for a new application framework</a> to use and more importantly the key things that I would want in one. After reading about the <a href="http://framework.zend.com/">Zend framework</a>, <a href="http://jeunito.me/zf1-11-doctrine-2-symfony-di-integration/www.symfony-project.org/">Symfony</a> and <a href="http://jeunito.me/zf1-11-doctrine-2-symfony-di-integration/laravel.com/">Laravel</a> and finding myself hesitant to use any one, I thought to myself why not get the best of each framework? So that's what I did.
</blockquote>
<p>
He shows a bit of the code to get them to all play nicely together using the Zend autoloader to register the other namespaces and creating a Symfony DI container inside of the ZF Bootstrap and providing it as a resource. You can find more of the source involved in the integration <a href="https://github.com/jeunito/zf-doctrine2-symfonydi">on his github account</a>.
</p>]]></description>
      <pubDate>Wed, 22 Aug 2012 11:09:21 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: An interesting negative take on Dependency Injection]]></title>
      <guid>http://www.phpdeveloper.org/news/18259</guid>
      <link>http://www.phpdeveloper.org/news/18259</link>
      <description><![CDATA[<p>
In <a href="http://www.reddit.com/r/PHP/comments/wrr0d/an_interesting_negative_take_on_dependency/">this recent post</a> to Reddit.com there's some commentary about an <a href="http://www.tonymarston.net/php-mysql/dependency-injection-is-evil.html">older article</a> sharing a negative spin on dependency injection and how it could cause more trouble that it's worth.
</p>
<blockquote>
The attitude of these pattern junkies doesn't work with me. *I* will decide whether or not I will use a particular design pattern, and *I* will decide how I implement it. This usually means that I don't use design patterns at all, and those that I do use are implemented in my own unique way. Because of this I am widely regarded as a maverick, a heretic and an outcast by those who consider themselves to be "proper" OO programmers. 
</blockquote>
<p>
Comments in the <a href="http://www.reddit.com/r/PHP/comments/wrr0d/an_interesting_negative_take_on_dependency/">Reddit post</a> talk about DI not being a "silver bullet", how it "empowers polymorphism" and how design patterns should not be done for the same of using design patterns 
</p>]]></description>
      <pubDate>Mon, 23 Jul 2012 10:06:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Charles Sprayberry's Blog: DI and global state]]></title>
      <guid>http://www.phpdeveloper.org/news/17470</guid>
      <link>http://www.phpdeveloper.org/news/17470</link>
      <description><![CDATA[<p>
In response to some of the comments made on his <a href="http://phpdeveloper.org/news/17457">previous post</a> about why you should use dependency injection in your applications, <i>Charles Sprayberry</i> is <a href="http://cspray.github.com/2012/01/29/DI-and-global-state.html">back with some more concrete examples</a> showing how it all works with some code to back it up.
</p>
<blockquote>
To help better explain each of the three aspects of DI I discussed in the previous article I'll be going over each more thoroughly and with those code examples requested. I'll be going through each point one at a time as the explanations will likely be of some length compared to the original post.
</blockquote>
<p>
He starts with the "villain" of the story - the Singleton design pattern, a difficult to test method that lulls you into thinking you're not in the global scope. He talks about the problem of using this approach and how the <a href="http://sourcemaking.com/design_patterns/factory_method">Factory</a> design pattern can be used to create an alternative. He changes up the example to create a "DbTableFactory" class that can be used to create the objects needed - in this case a "UserTable" object with the connection injected into it at construct time.
</p>]]></description>
      <pubDate>Tue, 31 Jan 2012 09:24:47 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Marcelo Gornstein's Blog: Writing PHP applications with Doctrine2 as ORM and Ding as DI container]]></title>
      <guid>http://www.phpdeveloper.org/news/17469</guid>
      <link>http://www.phpdeveloper.org/news/17469</link>
      <description><![CDATA[<p>
In a recent post <i>Marcelo Gornstein</i> takes a look at <a href="http://marcelog.github.com/articles/php_applications_with_doctrine2_orm_and_ding_di_container.html">using dependency injection with Doctrine2</a> using his <a href="http://marcelog.github.com/Ding">Ding</a> container.
</p>
<blockquote>
This article will show how we can develop software in php with a nifty design and architecture, and very much like other languages like java, using an ORM and an AOP, DI, Events container. I will assume you've read (or at least took a quick look) at <a href="http://marcelog.github.com/articles/creating_php_cli_standalone_portable_applications_with_pear_dependencies.html">this article</a> that explains the tree layout used throughout the code, and that you have some basic knowledge of <a href="http://www.doctrine-project.org/">Doctrine2</a> and used it before on your own.
</blockquote>
<p>
He starts with the result - an easy to use, self-contained (and decoupled) system for accessing the Doctrine2 instance. It's event-driven and uses <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">Aspect-oriented programming</a> to mange interactions between components (or as he calls them "beans"). Code is included for the entire process for a logger, the User entity, entity manager, user repository and transactional aspect. You can find the complete source for his example <a href="https://github.com/marcelog/Doctrine2-Ding-Example">on his github account</a>.
</p>]]></description>
      <pubDate>Tue, 31 Jan 2012 08:59:18 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Charles Sprayberry's Blog: Why you should use DI]]></title>
      <guid>http://www.phpdeveloper.org/news/17457</guid>
      <link>http://www.phpdeveloper.org/news/17457</link>
      <description><![CDATA[<p>
In <a href="http://cspray.github.com/2012/01/24/why-you-should-use-DI.html">this recent post</a> from <i>Charles Sprayberry</i> he explains why using dependency injection (DI) in your application is a good idea and can help make things easier in the long run.
</p>
<blockquote>
Dependency Injection is just a fancy term for passing dependencies to the object needing them instead of letting the object create its own. Hopefully, you've watched this <a href="http://googledata.org/google-testing/clean-code-talks-dependency-injection/">great Google Clean Code talk about dependency injection</a> by <a href="http://misko.hevery.com/">Misko Hevery</a> where he talks about why you should ask for things instead of looking for them. I'm gonna talk about some reasons to use DI beyond just those presented in the video. 
</blockquote>
<p>He breaks it up into a few different sections:</p>
<ul>
<li>It helps in the battle against global state
<li>It helps your design
<li>It makes using the single responsibility principle easier
</ul>]]></description>
      <pubDate>Fri, 27 Jan 2012 10:18:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevArticles.com: Singletons in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17218</guid>
      <link>http://www.phpdeveloper.org/news/17218</link>
      <description><![CDATA[<p>
On DevArticles.com today there's <a href="http://www.devarticles.com/c/a/PHP/Singletons-in-PHP/">a new tutorial</a> posted talking about one of the more popular design patterns, the Singleton, and how it can be implemented in PHP.
</p>
<blockquote>
Though in the past they enjoyed both popularity and a certain amount of prestige, without a doubt Singletons have progressively become one of the most evil and despicable villains in object-oriented design. Singletons earned their bad reputation for a reason: bringing them to life requires the programmer to deal at least with a static method. This is simply an elegant masquerade for creating a global access point (which in most cases is mutable as well) throughout an entire application. And we all know that global, mutable access is unquestionably a bad thing that must be avoided at all costs.
</blockquote>
<p>
In this first part (of two) of the series they introduce the Singleton pattern and show how, via an example of using a database adapter interface to work with a MySQL database, in a tightly coupled example. 
 In the second part of the series, they'll show how to break these apart using dependency injection.
</p>]]></description>
      <pubDate>Tue, 06 Dec 2011 10:17:33 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: Zend Framework 2.0: Dependency Injection (Part 1)]]></title>
      <guid>http://www.phpdeveloper.org/news/16953</guid>
      <link>http://www.phpdeveloper.org/news/16953</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Padraic Brady</i> takes a look at <a href="http://blog.astrumfutura.com/2011/10/zend-framework-2-0-dependency-injection-part-1/">dependency injection in Zend Framework 2.0</a>. 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.
</p>
<blockquote>
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. 
</blockquote>
<p>
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, <a href="http://pimple.sensiolabs.org/">Pimple</a>, 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.
</p>]]></description>
      <pubDate>Wed, 05 Oct 2011 12:34:33 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ralph Schindler's Blog: Learning About Dependency Injection and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16359</guid>
      <link>http://www.phpdeveloper.org/news/16359</link>
      <description><![CDATA[<p>
<i>Ralph Schindler</i> has a new post to his blog describing some of the what he's done to understand dependency injection in PHP and <a href="http://ralphschindler.com/2011/05/18/learning-about-dependency-injection-and-php">includes some illustrations</a> to share that information.
</p>
<blockquote>
Whatever the reason, one of the newest concepts (at least over the past 3 years or so) that has emerged as one of our heated topics of debate is how to manage object dependencies. Interestingly, the argument of how to manage dependencies is generally named by the solution which it's proponents give as the solution: <a href="http://en.wikipedia.org/wiki/Dependency_injection">dependency injection</a> (the abstract principle is actually called <a href="http://en.wikipedia.org/wiki/Inversion_of_control">Inversion of control</a>).
</blockquote>
<p>
He starts with simple examples - pushing an object into the creation of another - and backfills with a brief history of dependencies in PHP applications for a little context. He talks about DI frameworks like <a href="http://en.wikipedia.org/wiki/Spring_Framework">Spring</a> and some of the other criticisms and thoughts you'll need to consider when using DI (and DI containers) during development and deployment.
</p>]]></description>
      <pubDate>Thu, 19 May 2011 08:57:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lars Strojny's Blog: Dependency Injection Container Refactorings, Part Two]]></title>
      <guid>http://www.phpdeveloper.org/news/16318</guid>
      <link>http://www.phpdeveloper.org/news/16318</link>
      <description><![CDATA[<p>
<i>Lars Strojny</i> has posted the <a href="http://usrportage.de/archives/928-Dependency-Injection-Container-Refactorings,-Part-Two.html">second part</a> of his look at dependency injection and the refactoring it makes possible. If you'd like to start from the beginning, you can read about <a href="http://phpdeveloper.org/news/16223">part one here</a>.
</p>
<p>
He breaks it up into two sections (really three, but he advises to ignore the third):
</p>
<ul>Introducing a parameter in to the dependency injection container's configuration
<li>Setting it up to allow for checks against the environment (development, production, etc) 
<li>
</ul>
<p>
Code samples and example XML configurations are included for both points to help make them clearer.
</p>]]></description>
      <pubDate>Tue, 10 May 2011 09:24:53 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lars Strojny's Blog: Dependency Injection Container Refactorings, Part One]]></title>
      <guid>http://www.phpdeveloper.org/news/16223</guid>
      <link>http://www.phpdeveloper.org/news/16223</link>
      <description><![CDATA[<p>
New on his blog today <i>Lars Strojny</i> has posted the <a href="http://usrportage.de/archives/926-Dependency-Injection-Container-Refactorings,-Part-One.html">first part of his look at dependency injection</a> and how he's been using it to do some refactoring in his applications. He uses the Symfony DI container in his examples, but really you can apply the principles to just about any of the other current DI offerings.
</p>
<blockquote>
Working heavily with the Symfony2 Dependency Injection Container, I feel that we found some typical refactorings towards a DI container that emerge during the introduction of such a component. I want to write down the preliminary results of trying to systematize more or less as a draft. I will use the Symfony2 DI container configuration as an example but most of the refactorings should be applicable to other containers as well, some of them even to dependency injection without a container.
</blockquote>
<p>He's broken it up into a few different sections:</p>
<ul>
<li>Making a dependency explicit
<li>Introducing interface injection
<li>Exposing the service
</ul>]]></description>
      <pubDate>Wed, 20 Apr 2011 10:27:12 -0500</pubDate>
    </item>
  </channel>
</rss>
