<?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, 18 Jun 2013 21:22:45 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DPCRadio: Episode #2012-27 - Elizabeth Smith's "SPL in the Wild"]]></title>
      <guid>http://www.phpdeveloper.org/news/18731</guid>
      <link>http://www.phpdeveloper.org/news/18731</link>
      <description><![CDATA[<p>
The Dutch PHP Conference has posted their latest podcast in their DPCRadio series as recorded at this year's Dutch PHP Conference - <i>Elizabeth Smith</i>'s <a href="http://www.phpconference.nl/blog/775_dpcradio-4">SPL in the Wild</a>:
</p>
<blockquote>
The standard PHP library (SPL) is growing in both maturity and use. But a lot of developers still aren't aware of the tools in SPL or simply haven't seen good examples of how to use the code. From interfaces to an autoload stack to classes that make objects act like arrays, there are tools to make every application leaner and faster, or simply more clever. Using live projects from github, take a look at the good, bad, and the ugly of SPL usage in PHP development.
</blockquote>
<p>
You can listen to this latest episode either via the <a href="http://www.phpconference.nl/blog/775_dpcradio-4">in-page player</a> or by <a href="http://dpcradio.s3.amazonaws.com/2012_027.mp3">downloading it directly</a>. You can also <a href="https://itunes.apple.com/nl/podcast/dpc-radio/id568825964">subscribe to their feed</a> and get the latest as they're released.
</p>]]></description>
      <pubDate>Mon, 12 Nov 2012 12:53:38 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jeremy Cook's Blog: Implementing the ArrayAccess Interface]]></title>
      <guid>http://www.phpdeveloper.org/news/17490</guid>
      <link>http://www.phpdeveloper.org/news/17490</link>
      <description><![CDATA[<p>
<i>Jeremy Cook</i> is back with the next part of his series looking at the handy features PHP's <a href="http://php.net/spl">SPL</a> provides. In <a href="http://jeremycook.ca/2012/01/22/implementing-the-arrayaccess-interface/">this new post</a> he looks at the ArrayAccess interface and how it can make your data more accessible to PHP's own array handing functions.
</p>
<blockquote>
ArrayAccess allows you to treat an object that implements it as if it is an array for the purposes of setting, unsetting and retrieving data from it. Please note the emphasis in the last sentence! ArrayAccess does not make an object behave like an array in any other way. If you pass an object that implements ArrayAccess to a PHP array function such as in_array() you'll still get an error. This will become a little clearer with some of the examples below.
</blockquote>
<p>
He shows what you'll need to use this interface in your class - implementing the interface and defining a set of four methods to get/set and check for the value in your array. He includes a practical example of pulling data back from an API and wrapping it in a class to make accessing it simpler (also implementing the Countable interface as well, see the <a href="http://jeremycook.ca/2012/01/01/using-the-countable-interface/">previous post</a> for more on that). Code is include to illustrate how it can be used.
</p>]]></description>
      <pubDate>Thu, 02 Feb 2012 13:56:43 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jeremy Cook's Blog: Using the Countable Interface]]></title>
      <guid>http://www.phpdeveloper.org/news/17354</guid>
      <link>http://www.phpdeveloper.org/news/17354</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Jeremy Cook</i> has a tutorial <a href="http://jeremycook.ca/2012/01/01/using-the-countable-interface/">about using the Countable interface</a> (part of the SPL) in your objects to make them play nicely with functions like <a href="http://php.net/count">count</a>.
</p>
<blockquote>
PHP provides a number of predefined interfaces and classes that can really make your life as a developer easier but which are often overlooked. The functionality offered by the <a href="http://ca2.php.net/manual/en/book.spl.php">Standard PHP Library (SPL)</a> and the <a href="http://ca2.php.net/manual/en/reserved.interfaces.php">predefined interfaces</a> is extremely cool and very powerful but very underutilized. [...] I thought I'd write a few articles with examples of how I've used these classes and interfaces in the hope that someone would find it useful. I'd love it if people felt like commenting with their own examples too. I'll start with a quick look at the Countable interface.
</blockquote>
<p>
He includes sample code for classes using the Countable interface and defining the custom "count()" method inside. This method lets you define how the object will behave when something like <a href="http://php.net/count">count</a> is called on it. His examples show returning the number of items in a private variable, determining the state of an object and including logic to only find valid data (like from a database table).
</p>]]></description>
      <pubDate>Thu, 05 Jan 2012 14:39:05 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: How to use built-in SPL exception classes for better error handling]]></title>
      <guid>http://www.phpdeveloper.org/news/16310</guid>
      <link>http://www.phpdeveloper.org/news/16310</link>
      <description><![CDATA[<p>
On his blog today <i>Jani Hartikainen</i> looks at how you can <a href="http://codeutopia.net/blog/2011/05/06/how-to-use-built-in-spl-exception-classes-for-better-error-handling/">use the SPL exception types</a> to allow for better overall error handling in your application. Things like BadMethodCallException and OutOfBoundsException make the errors much more descriptive.
</p>
<blockquote>
Since PHP 5, there has been a bundle of built-in exceptions - the "SPL exceptions" - in PHP. However, the documentation for these classes is quite lacking in examples, and it can be difficult to understand when you should be using them. The short answer is always. 
</blockquote>
<p>The list of exception types he recommends include:</p>
<ul>
<li>BadMethodCallException
<li>DomainException
<li>LengthException
<li>OutOfRangeException
<li>UnexpectedValueException
</ul>
<p>
For each he gives an example usage of it, sometimes including a bit of code to illustrate. 
</p>]]></description>
      <pubDate>Mon, 09 May 2011 08:47:12 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Using SPL Iterators in PHP to Interact with Different Data Types]]></title>
      <guid>http://www.phpdeveloper.org/news/16060</guid>
      <link>http://www.phpdeveloper.org/news/16060</link>
      <description><![CDATA[<p>
On PHPBuilder.com today there's a new tutorial from <i>Jason Gilmore</i> about <a href="http://www.phpbuilder.com/columns/spl-iterators/Jason_Gilmore03162011.php3">using the SPL with different data types</a> to more effectively work with them more effectively.
</p>
<blockquote>
One great way to incorporate more OOP into your applications is through the Standard PHP Library (SPL), a powerful yet largely unknown extension made part of the official PHP language with the PHP 5.0 release. [...] In this tutorial I'll introduce you to several of my favorite SPL iterators, providing you with the basis from which you can continue your own exploration. Following several examples, I'll conclude with a brief introduction to other key SPL features.
</blockquote>
<p>
He looks at how to use the ArrayIterator, DirectoryIterator, SimpleXMLIterator and mentions some of the other handlers for things like <a href="http://www.php.net/manual/en/spl.datastructures.php">advanced data structures</a>, <a href="http://www.php.net/manual/en/spl.exceptions.php">exceptions</a> and more <a href="http://www.php.net/manual/en/spl.files.php">file handling</a>.
</p>]]></description>
      <pubDate>Thu, 17 Mar 2011 10:34:09 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPro.org: SPL Autoload]]></title>
      <guid>http://www.phpdeveloper.org/news/11408</guid>
      <link>http://www.phpdeveloper.org/news/11408</link>
      <description><![CDATA[<p>
On the PHPro.org website, <i>Kevin Waterson</i> has <a href="http://www.phpro.org/tutorials/SPL-Autoload.html">written up an introduction</a> to the handy autoloading functionality that comes with PHP5 releases - the __autoload method from the Standard PHP Library (SPL).
</p>
<blockquote>
The SPL __autoload() method is one of the Magic Methods supplied in PHP. The __autoload method is called whenever a class is instantiated and will load the classs the the first time it is called. No longer is include(), require, include_once() or require_once needed as the SPL autoload takes care of this interally. 
</blockquote>
<p>
He looks at how you can use it to load a directory of classes, how to use multiple autoloads in a single script and how to use it with interfaces to register a loader and include it as needed.
</p>]]></description>
      <pubDate>Fri, 14 Nov 2008 09:31:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Etienne Kneuss' Blog: SPL Datastructures updated]]></title>
      <guid>http://www.phpdeveloper.org/news/10170</guid>
      <link>http://www.phpdeveloper.org/news/10170</link>
      <description><![CDATA[<p>
<i>Etienne Kneuss</i> has <a href="http://www.colder.ch/news/05-12-2008/32/spl-datastructures-update.html">posted about</a> some updates to the data structures functionality in the Standard PHP Library (SPL), specifically some new additions.
</p>
<blockquote>
There finally is documentation for SplDoublyLinkedList, SplStack and SplQueue and some "new" classes: SplHeap (abstract), SplMaxHeap, SplMinHeap and SplPriorityQueue, documentation of those classes is in progress.
</blockquote>
<p>
An example of the new functionality (for SplPriorityQueue) is included in the post showing the insertion of a value into a pre-existing array (without having to slice or splice!).
</p>]]></description>
      <pubDate>Tue, 13 May 2008 09:31:24 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Larry Garfield's Blog: Good SPL intro]]></title>
      <guid>http://www.phpdeveloper.org/news/8776</guid>
      <link>http://www.phpdeveloper.org/news/8776</link>
      <description><![CDATA[<p>
<i>Larry Garfield</i> <a href="http://www.garfieldtech.com/blog/good-spl-intro">points out</a> one of the better resources for those looking to learn about the Standard PHP Library functionality - the <a href="http://devzone.zend.com/article/2565-The-Standard-PHP-Library-SPL">tutorial on the Zend Developer Zone</a>.
</p>
<blockquote>
Of course, the main problem is that the <a href="http://www.php.net/spl">official documentation</a> on it sucks. At best it points to an off-site series of <a href="http://www.php.net/~helly/php/ext/spl/">class hierarchies</a>. (Technically it's not off-site, but not internal to the manual.)
</blockquote>
<p>
The <a href="http://devzone.zend.com/article/2565-The-Standard-PHP-Library-SPL">article</a> talks mainly about iterators and some other "goodies" including exceptions and array handling.
</p>]]></description>
      <pubDate>Wed, 03 Oct 2007 10:27:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: The Standard PHP Library (SPL)]]></title>
      <guid>http://www.phpdeveloper.org/news/8727</guid>
      <link>http://www.phpdeveloper.org/news/8727</link>
      <description><![CDATA[<p>
The Zend Developer Zone has posted <a href="http://devzone.zend.com/article/2565-The-Standard-PHP-Library-SPL">a new article/tutorial</a> from <i>Ben Ramsey</i> covering one of the more powerful bits of functionality that's included with PHP5 - the Standard PHP Library (SPL).
</p>
<blockquote>
As its name implies, the goal of the Standard PHP Library-or SPL, for short-is to provide a standard library of interfaces that allows developers to take full advantage of object-oriented programming in PHP 5. [...] The functionality it provides includes, for example, the ability to define how your objects will react when iterated over with foreach, advanced array access, file and directory access, and advanced SimpleXML object handling. The largest chunk of functionality that the SPL provides comes in the form of iterators.
</blockquote>
<p>
<i>Ben</i> focuses on the iterators - three different kinds: IteratorAggregate, RecursiveIterator and SeekableIterator. The SPL also comes with a few other built-in kinds of iterators he mentions as well:
</p>
<ul>
<li>ArrayIterator
<li>DirectoryIterator
<li>FileIterator
</ul>
<p>
As a bonus, he <a href="http://devzone.zend.com/article/2565-The-Standard-PHP-Library-SPL#section3">also talks</a> about other "goodies" the SPL has to offer like exceptions, array handling, and file/directory access.
</p>
<p>
Also, check out <a href="http://benramsey.com/archives/spl-article-published/">Ben's comments</a> on his own blog about the article.
</p>]]></description>
      <pubDate>Wed, 26 Sep 2007 07:52:31 -0500</pubDate>
    </item>
  </channel>
</rss>
