<?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, 24 May 2012 05:49:12 -0500</pubDate>
    <ttl>30</ttl>
    <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[Chris Hartjes' Blog: Organzing Slim Framework Applications]]></title>
      <guid>http://www.phpdeveloper.org/news/17542</guid>
      <link>http://www.phpdeveloper.org/news/17542</link>
      <description><![CDATA[<p>
One of the more popular PHP microframeworks right now is <a href="http://www.slimframework.com/">Slim</a> and <i>Chris Hartjes</i> has <a href="http://www.littlehart.net/atthekeyboard/2012/02/14/organizing-slim-framework-apps/">a new post to his blog</a> about a good way he's found for organizing applications that use this handy tool.
</p>
<blockquote>
I've never really used a microframework in PHP before. I used <a href="http://flask.pocoo.org/">Flask</a> for a Python <a href="https://github.com/chartjes/liesitoldmykids">project</a> that I did to experiment with using Google App Engine. The principles seem to be quite similar (although I will admit that having decorators in PHP would be ineresting) but the trade-off with a microframework is that you usually have to figure out an application layout for yourself.
</blockquote>
<p>
He also uses the <a href="http://pimple.sensiolabs.org/">Pimple</a> dependency injection container, <a href="http://twig.sensiolabs.org/">Twig</a> templating and <a href="http://packagist.org/about-composer">Composer</a> for package management. He describes how he got it all set up - organizing the code so Composer could understand it, creating the Twig templates directory and creating some of his default routes.
</p>]]></description>
      <pubDate>Wed, 15 Feb 2012 08:57:28 -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[Chris Hartjes' Blog: Scope Is Not a Mouthwash]]></title>
      <guid>http://www.phpdeveloper.org/news/17175</guid>
      <link>http://www.phpdeveloper.org/news/17175</link>
      <description><![CDATA[<p>
<i>Chris Hartjes</i> has a reminder posted to his blog today in the form of <a href="http://www.littlehart.net/atthekeyboard/2011/11/25/scope-is-not-mouthwash/">this recent post</a> that "scope is not a mouthwash" - personal experience from his recent development where he forgot about something as simple as scoping (and it caused him all sorts of headaches).
</p>
<blockquote>
For [a chapter in my book on dependency injection] I am using <a href="http://pimple.sensiolabs.org/">Pimple</a>, an incredibly small but effective dependency injection container. Easy to use, simple and effective documentation, just what I was looking for. I also noticed that Pimple supported the use of closures (or anonymous functions) as a way of storing a dependency. Then things got stupid.
</blockquote>
<p>
He shares a bit of code showing how he added it to his bootstrap but was given a "cannot find class" error when he tried to use the tool. He walks through the steps he followed to track down the problem - looking closer at Pimple, investigating closures and, the ultimate problem, namespace scoping. He was missing a "" to start his namespace and closures work slightly differently:
</p>
<blockquote>
So why does it behave differently inside closures? I am not 100% sure, but if I had to make an educated guess I would say that when trying to resolve namespaces inside a closure, the interpretor doesn't assume that it is already inside the global namespace, that it is in a namespace of it's own.
</blockquote>]]></description>
      <pubDate>Mon, 28 Nov 2011 09:50:03 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: Zend Framework 2.0: Dependency Injection (Part 2)]]></title>
      <guid>http://www.phpdeveloper.org/news/16988</guid>
      <link>http://www.phpdeveloper.org/news/16988</link>
      <description><![CDATA[<p>
<i>Padraic Brady</i> is back today with the second part of his "Dependency Injection in Zend Framework 2.0" series. In <a href="http://blog.astrumfutura.com/2011/10/zend-framework-2-0-dependency-injection-part-2/">this second post</a> he talks about what dependency injection containers are (and aren't) and how they could lead to bad practices if they're considered as service locators.
</p>
<blockquote>
For Part 2, we're going to dig more into what a DIC is and isn't. I've already noted one very simple DIC called Pimple which will continue as one of my reference points since it best illustrates just how simple a DIC can be. In Part 3, we'll (finally) turn our attention to some actual source code. Baby steps. Parts 1 and 2 should get you thinking so that ZF 2.0&#8242;s DIC is a lot easier to understand and critique. We don't want anyone panicking just by throwing them into the deep end.
</blockquote>
<p>
He talks more about the <a href="http://pimple.sensiolabs.org/">Pimple</a> DIC tool and how, despite it's similarity to a set of Factory pattern calls, it's slightly different - think of it as "a container of executable Factories". He introduces the concept of a Service Locator, an object that can find and load other objects in an intelligent way. He notes that the most ideal DIC is an "external agent" that defines the object relationships outside of the application.
</p>
<p>
He points out a feature of ZF2 that allows for injection of the DIC into a controller, allowing it to look up the resources it needs. This of course, has issues - three that he mentions specifically:
</p>
<ul>
<li>Firstly, this isn't Dependency Injection. 
<li>Secondly, it creates objects which are useless without the specific DIC interface it depends on. 
<li>Thirdly, DICs are really bad Service Locators. 
</ul>]]></description>
      <pubDate>Thu, 13 Oct 2011 09:14:09 -0500</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[Fabien Potencier's Blog: Pimple, the small dependency injection container for PHP 5.3]]></title>
      <guid>http://www.phpdeveloper.org/news/12693</guid>
      <link>http://www.phpdeveloper.org/news/12693</link>
      <description><![CDATA[<p>
<i>Fabien Potencier</i> has <a href="http://fabien.potencier.org/article/29/pimple-the-small-dependency-injection-container-for-php-5-3">blogged about a tool</a> he's created, a small dependency injection container for PHP 5.3 he mentioned previously - <a href="http://github.com/fabpot/Pimple">Pimple</a>.
</p>
<blockquote>
Some people emailed me about a blog <a href="http://fabien.potencier.org/article/17/on-php-5-3-lambda-functions-and-closures">post</a> I wrote some time ago about a dependency injection container done in PHP 5.3. I have published on <a href="http://github.com/fabpot/twittee">Github</a> the small version of it (<a href="http://twittee.org/">Twittee</a>), but not the "working" version.
</blockquote>
<p>
So, he's updated the <a href="http://github.com/fabpot/Pimple">Pimple</a> source on Github with the latest and greatest for you to grab and use as you see fit. Remember, it does require PHP 5.3 (currently not released), so you couldn't (shouldn't!) use it in production yet.
</p>]]></description>
      <pubDate>Tue, 16 Jun 2009 09:35:54 -0500</pubDate>
    </item>
  </channel>
</rss>

