<?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>Sun, 19 May 2013 10:28:42 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Happy Accidents: Orno Skinny Series Part 1: Building a RESTful API]]></title>
      <guid>http://www.phpdeveloper.org/news/19332</guid>
      <link>http://www.phpdeveloper.org/news/19332</link>
      <description><![CDATA[<p>
On the Happy Accidents site there's <a href="http://happyaccidents.me/blog/orno-skinny-series-building-a-restful-api">a new post</a> talking about building a RESTful API (part one of the series) using the <a href="https://github.com/orno">Orno</a> dependency injection and MVC components.
</p>
<blockquote>
 have recently been writing a collection of PHP components exploring different design patterns for building applications. With the MVC layer close to completion I decided to write a couple of guides on how these components could be wired together to achieve several different application formats. First in this series will highlight the power of <a href="https://github.com/orno/di">OrnoDi</a> when used to resolve your objects, to do this we will be building a simple RESTful api with the minimal amount of configuration and bootstrap code. 
</blockquote>
<p>
He includes instructions to install the components (via Composer) and configure the DI container with the needed settings. He shows examples of the autoloading setup, how to handle the routing and how to create the sample model and controller to respond to the sample REST requests. 
</p>]]></description>
      <pubDate>Tue, 19 Mar 2013 11:36:54 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ralph Schindler: DI, DiC, & Service Locator Redux]]></title>
      <guid>http://www.phpdeveloper.org/news/18591</guid>
      <link>http://www.phpdeveloper.org/news/18591</link>
      <description><![CDATA[<p>
In his latest post <i>Ralph Schindler</i> takes another look at <a href="http://ralphschindler.com/2012/10/10/di-dic-service-locator-redux">the usefulness of Dependency Injection Containers</a> and whether or not they're the right thing to use for your situation.
</p>
<blockquote>
To DiC, or not to DiC: that has seemed to be the question in PHP for the last few years. Most people generally agree that injecting dependencies is the right thing to do. For those writing a framework, or any shared codebase where extensibility or the ability to grow the codebase is a core philosophical tenet, not injecting dependencies is doing a disservice to the project in the long run. So, as I've stated before, the question becomes how do we manage the added complexity that comes with practicing dependency injection?
</blockquote>
<p>
He briefly covers two topics that are often confused - the concepts of a service locator and a true dependency injection container. He then talks about the more correct situations to use each of them, mentioning a few questions you can ask about your app to determine the best fit. To illustrate, he includes a simple example where he mixed the two - DIC for models and service location for the controllers. 
</p>]]></description>
      <pubDate>Thu, 11 Oct 2012 10:43:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso: Dependency Injection Containers with PHP. When Pimple is not enough.]]></title>
      <guid>http://www.phpdeveloper.org/news/18434</guid>
      <link>http://www.phpdeveloper.org/news/18434</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post talking about dependency injection today and <a href="http://gonzalo123.wordpress.com/2012/09/03/dependency-injection-containers-with-php-when-pimple-is-not-enough/">proposes his own DIC</a> solution (dependency injection container) "when Pimple is not enough".
</p>
<blockquote>
Two months ago I wrote an article about Dependency Injection with PHP and Pimple. After the post I was speaking about it with a group of colleagues and someone threw a question: "What happens if your container grows up? Does Pimple scale well?" The answer is not so easy. Pimple is really simple and good for small projects, but it becomes a little mess when we need to scale.
</blockquote>
<p>
His solution comes from the Symfony2 framework itself - using <a href="https://github.com/symfony/DependencyInjection">its DIC separately </a> from the framework. He includes a configuration example and some simple classes that depend in each other. He also shows how to use imports in the config as well.
</p>]]></description>
      <pubDate>Mon, 03 Sep 2012 09:51:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Ferrara: Object Scoping: A Triste Against Service Containers]]></title>
      <guid>http://www.phpdeveloper.org/news/18394</guid>
      <link>http://www.phpdeveloper.org/news/18394</link>
      <description><![CDATA[<p>
In <a href="http://blog.ircmaxell.com/2012/08/object-scoping-triste-against-service.html">his most recent post</a> <i>Anthony Ferrara</i> talks about service containers, the cousin of dependency injection containers (DIC) that he argues aren't much better than global variables.
</p>
<blockquote>
I am a firm believer that service containers are not a form of Dependency Injection, and are only slightly better than global variables. That led me to make a <a href="https://twitter.com/ircmaxell/status/237957185974435840">few comments</a> that elicited a reply from two Fuel developers. That led to a rather interesting debate that just couldn't fit into 140 characters [on Twitter]... So I'm going to go into topics that are tightly related: variable scoping and service locators.
</blockquote>
<p>
He starts by defining what global variables are (including the requisite <a href="http://en.wikipedia.org/wiki/Global_variable">Wikipedia definition</a>) and how they're commonly use "everywhere" in the application, both set and read from. He contrasts this idea against a static variable from a class and redefines the scoping a bit when talking about objects and their properties. 
</p>
<blockquote>
So how does this apply to service locators (aka service containers or dependency injection containers)? Well, all state that's managed by a service locator immediately becomes global state to the objects that use the locator. So why is it all the rage? It's simple. It seems simple on the surface. If your object needs another dependency, there's no need to adjust how it's constructed, just pull it from the locator. Sounds great, right? Well, not quite.
</blockquote>
<p>
He points out some of the main issues with using service locators namely difficulty in unit testing them, dependencies within the container, how it violates both the <a href="http://en.wikipedia.org/wiki/Law_of_Demeter">Law of Demeter</a> and the <a href="http://en.wikipedia.org/wiki/Single_responsibility_principle">Single Responsibility Principle</a> as well as causing "hidden coupling" issues.
</p>]]></description>
      <pubDate>Thu, 23 Aug 2012 08:41:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Managing Class Dependencies: Dependency Injection, Service Locators & Factories, Pt 2]]></title>
      <guid>http://www.phpdeveloper.org/news/18151</guid>
      <link>http://www.phpdeveloper.org/news/18151</link>
      <description><![CDATA[<p>
PHPMaster.com has posted the second part of <i>Alejandro Gervasio</i>'s series looking at dependency injection, service locators and factories. In <a href="http://phpmaster.com/managing-class-dependencies-2/">this new part</a> of the series, he picks back up with his look at these patterns and how they can reduce your dependencies on things like "new" even more.
</p>
<blockquote>
While it's fair to admit that factories do have a neat niche in a number of special use cases, I'm not so merciless as to condemn Service Locators and plain Dependency Injection to an unfair exile. In this final part we'll take a closer look at the implementation of these popular patterns so that you can pick up the one that best suits the need at hand.
</blockquote>
<p>
He talks some about "class collaborators" as used in service locators and using it in his FileStorage example to find and use pre-created objects. He compares this method with a more simple dependency injection approach, noting that not only is it simpler to maintain but also can cause less overhead required for the DIC.
</p>]]></description>
      <pubDate>Thu, 28 Jun 2012 10:58:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: DIC vs. Service Locator]]></title>
      <guid>http://www.phpdeveloper.org/news/18058</guid>
      <link>http://www.phpdeveloper.org/news/18058</link>
      <description><![CDATA[<p>
In a new post to his blog, <i>Chris Hartjes</i> <a href="http://www.littlehart.net/atthekeyboard/2012/06/06/dic-vs-service-locator/">shares one thing</a> that you can use to make your code easier to test - using a dependency injection container and how it compares to a service locator.
</p>
<blockquote>
People often ask me what's the one thing they could do for their code base RIGHT NOW that will make it easier to test. To me, the answer is simple: make sure you are using Dependency Injection (yes the link is long and has code samples in Java, but whatever). Without the ability to "inject" your dependencies into your code (whether it is class methods or functions) you will have problems testing modules of code in isolation from each other.
</blockquote>
<p>
He shows the possible uses of DICs, including code samples, and talks the differences between the two. He explains that the real difference in them is how its being used. When it's used to add and remove instances, it's a container. When its actually put to use and passed into a class, it morphs into a service locator.
</p>]]></description>
      <pubDate>Thu, 07 Jun 2012 10:09:36 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Pascal Opitz's Blog: An example of how to use Pimple DI with ZF 1.x]]></title>
      <guid>http://www.phpdeveloper.org/news/17682</guid>
      <link>http://www.phpdeveloper.org/news/17682</link>
      <description><![CDATA[<p>
<i>Pascal Opitz</i> has a really quick post to his blog showing a snippet of code about <a href="http://blog.pascalopitz.com/post/An-example-of-how-to-use-Pimple-DI-with-ZF-1-x">using Pimple with the Zend Framework 1</a>.
</p>
<blockquote>
After having had a look at Silex, and struggling with the somewhat cumbersome ini configurations and YADIF, I wanted to try out whether I could use Pimple as DI container for ZF 1.x Turns out I can, as you can just select Pimple to be the bootstrap container.
</blockquote>
<p>
Hsi example (<a href="https://gist.github.com/2043711">gist of the code here</a>) also shows how to subclass the container and add in some default settings objects into the container. <a href="https://github.com/fabpot/Pimple">Pimple</a> is a small, lightweight dependency injection container from <i>Fabien Potencier</i> of the Symfony framework.
</p>]]></description>
      <pubDate>Fri, 16 Mar 2012 08:30:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Marcelo Gornstein's Blog: Dependency injection with Xml and Yaml in the Ding container]]></title>
      <guid>http://www.phpdeveloper.org/news/17584</guid>
      <link>http://www.phpdeveloper.org/news/17584</link>
      <description><![CDATA[<p>
In <a href="http://marcelog.github.com/articles/ding_xml_yaml_di_dependency_injection.html">this new post</a> to his blog today <i>Marcelo Gornstein</i> looks at doing some dependency injection in a simple application via XML and YAML configurations and the <a href="http://marcelog.github.com/Ding">Ding</a> dependency injection container.
</p>
<blockquote>
In this <a href="http://marcelog.github.com/articles/ding_component_bean_annotations_di_dependency_injection.html">past article</a> I've discussed the dependency injection features when using annotations. This time, we'll see how to use the xml and yaml drivers to do the same (setter and constructor injection). If you don't know how to configure the xml and yaml drivers, please start by reading <a href="http://marcelog.github.com/articles/ding_example_xml_yaml_annotations_bean_drivers_tutorial_how_to.html">this</a>.
</blockquote>
<p>
He describes the different injection methods available with the container - setter injection, constructor injection and method injection. Example configuration content is included - both the XML and YAML versions.
</p>]]></description>
      <pubDate>Fri, 24 Feb 2012 11:37:04 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Ade Slade's Blog: Integrating Zend Framework 1 and Pimple]]></title>
      <guid>http://www.phpdeveloper.org/news/17414</guid>
      <link>http://www.phpdeveloper.org/news/17414</link>
      <description><![CDATA[<p>
In <a href="http://adeslade.co.uk/post/integrating-zend-framework-1-and-pimple">this new post</a> to his blog <i>Ade Slade</i> shows how to integrate the <a href="http://pimple.sensiolabs.org/">Pimple</a> lightweight dependency injection container with a Zend Framework application.
</p>
<blockquote>
This post will describe a way to integrate Zend Framework 1 and <a href="http://pimple.sensiolabs.org/">Pimple</a>. A complete working version of the code is available on <a href="https://github.com/adeslade/Zend-Framework-Pimple">github</a>. Thankfully, Zend Framework 2 features its own Dependency Injection Container. Happy days. Still, if you're not prepared to wait, you may find this useful.
</blockquote>
<p>
He shows how to add a resource plugin into the Pimple container - an entity manager that's part of <a href="http://doctrine-project.org">Doctrine</a>. He creates his controller, pulling the manager from the Pimple container and includes a unit test for the controller too (using PHPUnit, but he also suggests <a href="https://github.com/padraic/mockery">Mockery</a>).
</p>]]></description>
      <pubDate>Wed, 18 Jan 2012 13:11:56 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Henrik Bj&oslash;rnskov's Blog: Stampie an in depth look]]></title>
      <guid>http://www.phpdeveloper.org/news/17266</guid>
      <link>http://www.phpdeveloper.org/news/17266</link>
      <description><![CDATA[<p>
<i>Henrik Bj&oslash;rnskov</i> has posted a bit of an <a href="http://henrik.bjrnskov.dk/stampie-in-depth/">in-depth look at Stampie</a>, an abstraction library for sending emails from PHP applications via various service providers (like <a href="http://sendgrid.com/">SendGrid</a> and <a href="http://mailchimp.com/">Mailchimp</a>).
</p>
<blockquote>
So what is Stampie. Stampie is a API wrapper for the most common email sending services. It provides a standard PHP Api to send emails. But mostly it is a project to test TDD and experiment with a couple of different things. Stampie is developed with Dependency Injection and therefore there is a lot of objects. At the start it can be quite cumbersome, but will make a lot of sense if you start to develop and add additional provider.
</blockquote>
<p>
He includes a bit of sample code showing the sending of a message via the SendGrid API backend. Extending the system is simpler thanks to DI and the customizable MailerInterface object type. There's also an AdapterInterface object that can be used to redefine the HTTP connection interface the tool uses. He also points to <a href="http://github.com/henrikbjorn/HBStampieBundle">the HBStampieBundle</a> bundle for the Symfony2 framework that can make dropping it into your current SF2 application simpler.
</p>
]]></description>
      <pubDate>Thu, 15 Dec 2011 12:48:25 -0600</pubDate>
    </item>
  </channel>
</rss>
