<?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>Wed, 22 May 2013 11:32:44 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[WebSpeaks.in: Learn Simple Method Chaining in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15942</guid>
      <link>http://www.phpdeveloper.org/news/15942</link>
      <description><![CDATA[<p>
On WebSpeaks.in today there's a recent post that introduces you to something more and more applications are using - especially frameworks - <a href="http://www.webspeaks.in/2011/02/learn-method-chaining-with-advanced.html">method chaining</a> in PHP OOP apps.
</p>
<blockquote>
In this article we will learn an advanced OOPS programming concept in PHP known as Method chaining. If you have worked on PHP frameworks like Zend, Magento or CakePHP, you might have noticed a very convinient style of accessing methods of different classes. [...] This type of programming technique is known as method chaining. If you are thinking how is it possible to perform this chaining, then don't worry. Today we will learn this fancy concept.
</blockquote>
<p>
They create a simple class, a Person, and show the difference between calling several methods on the created object versus a method chained example that calls all three, making updates to the object itself ($this). There's also a bit more complicated example with three different classes in the mix.
</p>]]></description>
      <pubDate>Tue, 22 Feb 2011 11:09:13 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Mark van der Velden's Blog: PHP Quiz part 4]]></title>
      <guid>http://www.phpdeveloper.org/news/15370</guid>
      <link>http://www.phpdeveloper.org/news/15370</link>
      <description><![CDATA[<p>
If you were a fan of the <a href="http://phpdeveloper.org/news/12514">PHP</a> <a href="http://phpdeveloper.org/news/13279">quizes</a> that <i>Mark van der Velden</i> has posted in the past, you'll be happy to know he's come back with <a href="http://blog.dynom.nl/archives/PHP-Quiz-part-4_20101102_51.html">part four</a> of the series after a bit of a hiatus.
</p>
<blockquote>
It has been a while, but here is part 4 of the PHP Quiz series! A few questions to crack your brain about, or perhaps you know them all? Try them and find out! Also do read the idea behind these quizzes, here: <a href="http://blog.dynom.nl/archives/The-PHP-Quiz-series_20090925_46.html">The PHP Quiz series</a>
</blockquote>
<p>
In this quiz he tests your knowledge of class visibility, fluent method handling, class extension, strptime and a tricky "for" loop. Take <a href="http://blog.dynom.nl/archives/PHP-Quiz-part-4_20101102_51.html">the quiz</a> and see how you do.
</p>]]></description>
      <pubDate>Tue, 02 Nov 2010 12:05:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: Using a builder to construct complex classes]]></title>
      <guid>http://www.phpdeveloper.org/news/12266</guid>
      <link>http://www.phpdeveloper.org/news/12266</link>
      <description><![CDATA[<p>
If your code is getting more and more complex all the time and you find yourself creating a similar group of objects over and over, you might check out <a href="http://codeutopia.net/blog/2009/04/01/using-a-builder-to-construct-complex-classes/">Jani Hartikainen's latest advice</a> and create a "builder" around them.
</p>
<blockquote>
Sometimes if you have a complex class, which needs to be set up in a specific way: Perhaps it takes a lot of constructor arguments, or often requires calling some setters. [...] Sometimes if you have a complex class, which needs to be set up in a specific way: Perhaps it takes a lot of constructor arguments, or often requires calling some setters.
</blockquote>
<p>
His example is a "message builder" wrapper that lets you specify the receiver, sender and message and inject them into a to() method call (with a fluent interface). He shows how to make sure that the object you need (the message object) is always complete.
</p>]]></description>
      <pubDate>Thu, 02 Apr 2009 12:58:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ProDevTips Blog: Fluent Arrays and Strings in PHP - Adding JSON and more]]></title>
      <guid>http://www.phpdeveloper.org/news/10626</guid>
      <link>http://www.phpdeveloper.org/news/10626</link>
      <description><![CDATA[<p>
<i>Henrik</i> continues his look at fluent arrays and strings in PHP with <a href="http://www.prodevtips.com/2008/07/11/fluent-arrays-and-strings-in-php-adding-json-and-more/">this second part</a> of his series, adding JSON functionality into the mix.
</p>
<blockquote>
Recently I've had the need to extend the interface further, among other things with JSON support. I've used code published by <a href="http://moblur.org/post/2008/02/23/Ajax-Json-et-compression-Gzip">Nicolas Crovatti</a> to do this. 
</blockquote>
<p>
His <a href="http://www.prodevtips.com/2008/07/11/fluent-arrays-and-strings-in-php-adding-json-and-more/">example</a> shows how the script works to plot out some points for a table of stats. He follows this with an in-depth look at the different methods making up that fluent call (apply2Field, fill_ret, sum and plot). These make the array that can then be passed off to PHP, using <a href="http://www.php.net/json_encode">json_encode</a> to make an easy-consumable JSON message out of the results.
</p>]]></description>
      <pubDate>Thu, 17 Jul 2008 09:32:26 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ProDevTips Blog: Fluent Arrays and Strings in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/10457</guid>
      <link>http://www.phpdeveloper.org/news/10457</link>
      <description><![CDATA[<p>
On the ProDevTips blog, <i>Henrik</i> has written up an <a href="http://www.prodevtips.com/2008/06/23/fluent-arrays-and-strings-in-php/">extensive tutorial</a> with plenty of code examples on working with something inspired by a few other languages - fluent arrays and strings.
</p>
<blockquote>
I've been working some with jQuery and Ruby lately, as you might know they both have very neat fluent interfaces for writing short and easily understandable code. Especially Ruby's array and string handling should be something that can be done in PHP so I started googling. [...] It's probably very possible that what I'm looking for is already part of some PHP framework or such but I didn't want to spend more time looking than being productive.
</blockquote>
<p>
Based on some Ruby examples, he defines a set of functions that can be use to create these fluent interfaces to the common PHP variable types (contained in a class for easy use). The entire source can be <a href="http://www.prodevtips.com/wp-content/uploads/2008/06/fluent.rar">downloded here</a>.
</p>]]></description>
      <pubDate>Mon, 23 Jun 2008 07:57:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: Designing Klingon Warships Using Behaviour Driven Development]]></title>
      <guid>http://www.phpdeveloper.org/news/9608</guid>
      <link>http://www.phpdeveloper.org/news/9608</link>
      <description><![CDATA[<p>
The Zend Developer Zone has <a href="http://devzone.zend.com/article/3082-Designing-Klingon-Warships-Using-Behaviour-Driven-Development">another new tutorial</a> from <i>Padraic Brady</i> talking about testing your applications (i.e. unit tests). In this new article, he expands on his <a href="http://devzone.zend.com/article/2772-An-Introduction-to-the-Art-of-Unit-Testing-in-PHP">previous one</a> and dives a bit deeper into the behaviour-driven development process.
</p>
<blockquote>
In this article, I introduce a TDD related practice called Behaviour-Driven Development which has been gathering attention for over a year and gaining converts (like me!).
</blockquote>
<p>
He <a href="http://devzone.zend.com/article/3082-Designing-Klingon-Warships-Using-Behaviour-Driven-Development">briefly covers</a> what BDD is and how it can be used to solidify code against issues that might come up down the road (and how it compares to test-driven development). Some sample code/tests are included to give you a better idea of how it all fits together - a set of scenarios for any given "story". True to the title, <i>Padraic</i> writes his tests around the construction of a Klingon Bird of Prey ship. 
</p>]]></description>
      <pubDate>Mon, 11 Feb 2008 15:34:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Alex Netkachov's Blog: PHP fluent API tips]]></title>
      <guid>http://www.phpdeveloper.org/news/8920</guid>
      <link>http://www.phpdeveloper.org/news/8920</link>
      <description><![CDATA[<p>
In response to <i>Travis Swicegood</i>'s <a href="http://www.phpdeveloper.org/news/8917">post about fluent APIs</a>, <i>Alex Netkachov</i> has <a href="http://www.alexatnet.com/node/98">added some of his own examples</a> to the topic from the Zend Framework and the popular Javascript library, jQuery.
</p>
<blockquote>
In his <a href="http://www.travisswicegood.com/index.php/2007/10/26/fluent_api_here_i_come">recent post</a> Travis Swicegood is talking about the "Fluent API". This kind of API is very popular in scripting languages and I use it during my work with <a href="http://framework.zend.com/">Zend Framework</a> or <a href="http://jquery.com/">jQuery</a> projects. Another good example of such technique is <a href="http://www.w3.org/DOM/">Document Object Model</a> API.
</blockquote>
<p>
His <a href="http://www.alexatnet.com/node/98">examples</a> show the method chaining that's the hallmark of fluent interfaces. Unfortunately, there's no good way to just make an object and call a fluent interface on it in PHP, so <i>Alex</i> suggests a simple little wrapper (that just returns the object) to make it easier.
</p>]]></description>
      <pubDate>Mon, 29 Oct 2007 07:57:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Paul Jones' Blog: Brief Intro to Solar_Http_Request and Response]]></title>
      <guid>http://www.phpdeveloper.org/news/8264</guid>
      <link>http://www.phpdeveloper.org/news/8264</link>
      <description><![CDATA[<p>
<i>Paul Jones</i> gives readers a <a href="http://paul-m-jones.com/blog/?p=252">quick overview</a> of two of the components in the Solar framework in a new post to his blog today - the Solar_Http_Request class and it's opposite, the Solar_Http_Response class.
</p>
<blockquote>
As I noted in an <a href="http://paul-m-jones.com/blog/?p=249">earlier post</a>, <a href="http://solarphp.com/">Solar</a> how has classes to represent simple HTTP requests and responses.
</blockquote>
<p>
The <a href="http://solarphp.com/class/Solar_Http_Request_Adapter">Solar_Http_Request</a> functionality is only for making requests, but uses adapters to make it easier to swap out the connection method later on - plus it's fluent. He includes an example of it in action, calling a remote page with a GET, POST and a customized request (including special headers)
</p>
<p>
The other side of the equation, <a href="http://solarphp.com/class/Solar_Http_Response">Solar_Http_Response</a> allows you to set all of the response information manually (again, fluently) to make custom responses simple.  
</p>]]></description>
      <pubDate>Tue, 17 Jul 2007 08:42:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: Fluent Interfaces in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/6946</guid>
      <link>http://www.phpdeveloper.org/news/6946</link>
      <description><![CDATA[<p>
The Zend Developer Zone has posted <a href="http://devzone.zend.com/node/view/id/1362">a new article</a> from editor of the dZone, <i>Cal Evans</i>, looking at using fluent interfaces in PHP.
</p>
<blockquote>
Fluent Interfaces are not a new programming construct. However, PHP developers have not been able to use them until PHP 5. Now with PHP 5 and the ability to directly dereference an object, PHP developers can build objects using fluent interfaces.
</blockquote>
<p>
He <a href="http://devzone.zend.com/node/view/id/1362">starts off</a> with a look at what they are and how (and why) they can be used in an application. He includes code example to help show how you would create an interface (makeNormal). 
</p>
The code and other information are pulled from a few sources:
<ul>
<li><a href="http://www.mikenaberezny.com/archives/35">this article</a> by <i>Mike Naberezny</i> 
<li><a href="http://paul-m-jones.com/blog/?p=188">a post</a> from <i>Paul Jones</i>
<li>a <a href="http://martinfowler.com/bliki/FluentInterface.html">blog post</a> from <i>Martin Fowler</i>
</ul>
<i>Cal</i> also mentions what he got into the fluent interfaces game for - creating a tag cloud with a fluent interface over the normal arguments/properties method.
</p>]]></description>
      <pubDate>Wed, 20 Dec 2006 08:55:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Davey Shafik's Blog: Next Generation REST Web Services Client]]></title>
      <guid>http://www.phpdeveloper.org/news/6333</guid>
      <link>http://www.phpdeveloper.org/news/6333</link>
      <description><![CDATA[<p>
In his <a href="http://pixelated-dreams.com/archives/243-Next-Generation-REST-Web-Services-Client.html">latest post</a>, <i>Davey Shafik</i> talks about a web service client that he's been working up for the Zend Framework, specifically dealing with the consuming and creation of REST services.
</p>
<blockquote>
<p>
I am currently working on a ton of Web Services related things for the Zend Framework, one of my favorite, is the almost complete, Zend_Rest_Client. This is a replacement for Zend_Rest (as we're adding a server also).
</p>
<p>
Whilst it is almost impossible to emulate the PHP 5 SOAP extension, it is still possible to get a nice interface.
</p>
</blockquote>
<p>
He <a href="http://pixelated-dreams.com/archives/243-Next-Generation-REST-Web-Services-Client.html">gives some examples</a> of its usage: 
<ul>
<li>creating a client with three lines of code
<li>showing off the "fluent API" of the component to make a REST request
<li>and a call normally, seperating the methods out into seperate lines
</ul>
He also mentions that there's still a bit of work to be done, including returning the Zend_Rest_Server array responses back into normal PHP arrays.
</p>]]></description>
      <pubDate>Fri, 22 Sep 2006 07:25:38 -0500</pubDate>
    </item>
  </channel>
</rss>
