<?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>Tue, 21 May 2013 15:47:38 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Paul Jones' Blog: When Possible, Use File *Resources* Instead Of File *Names*]]></title>
      <guid>http://www.phpdeveloper.org/news/18173</guid>
      <link>http://www.phpdeveloper.org/news/18173</link>
      <description><![CDATA[<p>
In <a href="http://paul-m-jones.com/archives/2487">this new post</a> to his blog <i>Paul Jones</i> makes a suggestion when you're working with files or external connections in your PHP applications - pass the resource, not the file/path name for more flexibility.
</p>
<blockquote>
In testing the <a href="https://github.com/auraphp/Aura.Http">Aura.Http</a> package, I have realized that it's much more flexible, testing wise, to pass around file resources (a.k.a. handles, pointers, or streams) than it is to pass around file names. When you do that, you can use a php://memory stream instead of attempting to touch the file system.
</blockquote>
<p>
He shows how using this method can make it easier to test with a simple bit of refactoring by passing in the "php://memory" stream rather than the actual file reference. The comment (from <i>Chris Hartjes</i>) also suggests an alternative tool for working with tests that need the file system, <a href="https://github.com/mikey179/vfsStream">vfsStream</a>.
</p>]]></description>
      <pubDate>Wed, 04 Jul 2012 14:10:49 -0500</pubDate>
    </item>
  </channel>
</rss>
