<?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>Mon, 20 May 2013 04:44:39 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: REST - Can You do More than Spell It? Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/17881</guid>
      <link>http://www.phpdeveloper.org/news/17881</link>
      <description><![CDATA[<p>
On the PHPMaster.com site there's a recent tutorial posted, the first part in a series of posts from <i>David Shirey</i> about <a href="http://phpmaster.com/rest-can-you-do-more-than-spell-it-1/">building REST APIs in PHP</a>. This first part of the series stays pretty high-level and really just introduces some common REST concepts.
</p>
<blockquote>
Thousands of years ago when we first started building web pages, things were very simple. You'd put some text on the page, maybe even an image, and that was pretty much it. But today it's a whole different ball game. Instead of static pages there's the dynamic applications we've come to depend on. And so, how these applications are designed to communicate becomes very important. In this series I'll introduce you to the REST architecture style. In this article I'll help you to understand exactly what it is, and later I'll show you how it can be implemented in a PHP environment.
</blockquote>
<p>
He defines the term "REST" for those not familiar and how a typical RESTful API allows other end users/software to interact directly with its data. He outlines some of the common principles of REST and finishes the post with a comparison of two HTTP verbs - PUT and POST.
</p>]]></description>
      <pubDate>Mon, 30 Apr 2012 09:51:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: An Intro to Virtual Proxies, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/17838</guid>
      <link>http://www.phpdeveloper.org/news/17838</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial from <i>Alejandro Gervasio</i> about <a href="http://phpmaster.com/intro-to-virtual-proxies-1/">using virtual proxies</a> in your application - a method in development that provides a layer of abstraction on top of domain objects and makes it more efficient to work with (and lazy load) them.
</p>
<blockquote>
Often referenced by a few other fancy names, the substitute is generically called a <a href="http://en.wikipedia.org/wiki/Proxy_pattern">virtual proxy</a>, a sort of stand-in that exploits the neatness of Polymorphism and interacts with the actual domain objects. Proxies aren't new to PHP. <a href="http://www.doctrine-project.org/">Doctrine</a> and <a href="http://framework.zend.com/">Zend Framework 2.x</a> make use of them, although with different aims. On behalf of a didactic cause, however, it would be pretty instructive to implement some custom proxy classes and use them for lazy-loading a few basic aggregates from the database, this way illustrating how virtual proxies do their stuff under the hood.
</blockquote>
<p>
He starts off by setting up a domain model for a "Post" and "Author" - a typical blog example.Based on the definition of these classes, he creates a mapper class to generate Author objects and an "AuthorProxy" class that uses a "loadAuthor" method to only load in the author's details when a property is requested. He gives a bit more code showing it in action and the difference between using the normal Author and AuthorProxy class.
</p>]]></description>
      <pubDate>Thu, 19 Apr 2012 08:52:44 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Building a Domain Model - An Introduction to Persistence Agnosticism]]></title>
      <guid>http://www.phpdeveloper.org/news/17591</guid>
      <link>http://www.phpdeveloper.org/news/17591</link>
      <description><![CDATA[<p>
On PHPMaster.com there's <a href="http://phpmaster.com/building-a-domain-model/">a recent tutorial</a> introducing the concept of a "domain model" and showing how to create them in PHP (manually, not inside of any ORM or database solution).
</p>
<blockquote>
First off, creating a rich Domain Model, where multiple domain objects with well-defined constraints and rules interact, can be a daunting task. Second, not only is it necessary to define from top to bottom the model itself, but it's also necessary to implement from scratch or reuse a mapping layer in order to move data back and forward between the persistence layer and the model in question. 
</blockquote>
<p>
They include an example of a set of domain models tat relate to one another - a blog setup with posts, comments and users. They show how to create the AbstractEntity to handle a bit of the magic behind the scenes, an example "Post" and "Comment" models and how they can be put to work creating some posts and appending comments. A little bit of markup is included to output the results.
</p>]]></description>
      <pubDate>Mon, 27 Feb 2012 12:58:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Building A RESTful PHP Server: Routing the Request]]></title>
      <guid>http://www.phpdeveloper.org/news/17433</guid>
      <link>http://www.phpdeveloper.org/news/17433</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> is back with a second installment in her "Building a RESTful PHP Server" series with <a href="http://www.lornajane.net/posts/2012/building-a-restful-php-server-routing-the-request">this new post</a> about handling and routing the incoming requests. (You can find the first part about working with the request <a href="http://phpdeveloper.org/news/17418">here</a>)
</p>
<blockquote>
This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.
</blockquote>
<p>
She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction" 
 methods for responding to GET and POST requests.
</p>]]></description>
      <pubDate>Mon, 23 Jan 2012 11:14:11 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: POSTing JSON Data With PHP cURL]]></title>
      <guid>http://www.phpdeveloper.org/news/17161</guid>
      <link>http://www.phpdeveloper.org/news/17161</link>
      <description><![CDATA[<p>
On her blog today <i>Lorna Mitchell</i> has a quick tip for anyone having an issue sending POSTed JSON data with the <a href="http://php.net/curl">curl</a> functionality that can be built into PHP. The <a href="http://www.lornajane.net/posts/2011/posting-json-data-with-php-curl">trick to her method</a> is sending things with the right header.
</p>
<blockquote>
We can't send post fields, because we want to send JSON, not pretend to be a form (the merits of an API which accepts POST requests with data in form-format is an interesting debate). Instead, we create the correct JSON data, set that as the body of the POST request, and also set the headers correctly so that the server that receives this request will understand what we sent.
</blockquote>
<p>
She includes a code example (about ten lines) showing the POSTing process that sets up options using curl's <a href="http://php.net/curl_setopt">curl_setopt</a>. Be sure to set up the headers to send as "application/json" - that's the trick to letting the remote end know the format.
</p>]]></description>
      <pubDate>Tue, 22 Nov 2011 18:06:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Building RESTful APIs with the Slim Microframework]]></title>
      <guid>http://www.phpdeveloper.org/news/16958</guid>
      <link>http://www.phpdeveloper.org/news/16958</link>
      <description><![CDATA[<P>
On PHPBuilder.com today there's a new tutorial from <i>Jason Gilmore</i> about building a <a href="http://www.phpbuilder.com/columns/RESTfulAPIs/RESTfulAPIs_10-04-2011.php3">simple RESTful API with Slim</a>, a microframework for PHP.
</p>
<blockquote>
Although a relatively new entrant in the PHP framework sweepstakes, I've been lately quite intrigued by <a href="https://github.com/codeguy/Slim">Slim</a>, a slick RESTful microframework modeled after Ruby's <a href="http://www.sinatrarb.com/">Sinatra</a>, which is coincidentally by far <a href="http://www.developer.com/lang/rubyrails/building-an-ajax-friendly-rest-api-with-sinatra.html">my favorite microframework</a> available for any programming language. In this article I'll show you just how easy it is to get started building a powerful RESTful API using this streamlined framework.
</blockquote>
<p>
Setup of the framework is as simple as downloading the latest copy from <a href="https://github.com/codeguy/Slim">its github repository</a>. It can then be included and used to make the simple routes in his examples. He uses a "games" request type to show how to handle GET, POST and PUT requests through Slim's simple interface.
</p>]]></description>
      <pubDate>Thu, 06 Oct 2011 10:12:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Web Development Blog: How-to show popular posts on your WordPress blog?]]></title>
      <guid>http://www.phpdeveloper.org/news/15445</guid>
      <link>http://www.phpdeveloper.org/news/15445</link>
      <description><![CDATA[<p>
On the Web Development Blog there's <a href="http://www.web-development-blog.com/archives/how-to-show-popular-posts-on-your-wordpress-blog/">a recent post</a> that shows you how to, with a simple bit of code, pull out the most popular posts to your <a href="http://wordpress.org">WordPress</a> blog.
</p>
<blockquote>
Since I'm using WordPress.com Stats, I would like to use the rankings generated by this service or plugin. Searching Google, I found some widget called "<a href="http://pepijndevos.nl/2010/02/wordpress-com-stats-top-posts-widget">WordPress.com Stats: Top Posts Widget</a>" which works out of the box (if like to use a widget). In my case I have a custom sidebar with different custom sections using custom code. The following example explains how-to use that code on your website.
</blockquote>
<p>
WordPress, by default, doesn't track any statistic information about the posts on your site, so you'll need something like the <a href="http://wordpress.org/extend/plugins/stats/">WordPress Stats plugin</a> to get that part working. Once that's there, you can use his code to pull out the posts from the last few days (configurable) and show the most popular of the list.
</p>]]></description>
      <pubDate>Wed, 17 Nov 2010 10:37:13 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Testing Form Posts in Zend Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/15175</guid>
      <link>http://www.phpdeveloper.org/news/15175</link>
      <description><![CDATA[<p>
In a new post to his blog today <i>Chris Hartjes</i> talks about the trials and tribulations he had when trying to <a href="http://www.littlehart.net/atthekeyboard/2010/09/22/testing-form-posts-in-zend-framework/">test POST requests</a> in his Zend Framework application with Zend_Test/PHPUnit.
</p>
<blockquote>
I had done a refactoring of the way a model was pulling in stats for running backs and receivers for a fantasy game. As a result, in production (you suck Chris) you could not see results for those players. The data was there, I had not properly tested things. A familiar situation. So, I fixed the code and wrote my more-specific-than-before unit tests, but I decided I also wanted to make sure that the output on the page itself worked correctly. This began the descent into madness.
</blockquote>
<p>
He found several examples of ways to test POST requests but none of them worked in his situation. They used an object chaining method that just didn't cooperate for him, so he figured out another way. The code for it's included in the post - it uses the getRequest method to set up and send the POST request.
</p>]]></description>
      <pubDate>Thu, 23 Sep 2010 10:36:42 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Raw vs. cooked PHP $_POST variables]]></title>
      <guid>http://www.phpdeveloper.org/news/15155</guid>
      <link>http://www.phpdeveloper.org/news/15155</link>
      <description><![CDATA[<p>
<i>Sameer Borate</i> as a new post to his blog today looking at <a href="http://www.codediesel.com/php/raw-vs-cooked-php-post-variables/">some of the quirks</a> he's found when dealing with the $_POST superglobal in PHP.
</p>
<blockquote>
A little quirk of PHP $_POST var I encountered while fixing a Salesforce web-to-Lead bug. A Wordpress site was using a form to submit user requests to the Salesforce web-service. The form that submitted the data had the following fields along with the others. The problem was with the multi-select field, only the last value selected in the multi-select was getting captured.
</blockquote>
<p>
He investigated and found that his code was echoing out all of the values, but wasn't using the "field_name[]" notation with the square brackets to send back multiple values to PHP. Changing this and trying again, he noticed it still wasn't working as expected (with Salesforce). He figured out they're using "raw" versus "cooked" handling of the POSTed variables. Check out the <a href="http://www.codediesel.com/php/raw-vs-cooked-php-post-variables/">rest of his post</a> to find out what that means.
</p>]]></description>
      <pubDate>Mon, 20 Sep 2010 10:15:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Three Ways to Make a POST Request from PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/13864</guid>
      <link>http://www.phpdeveloper.org/news/13864</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has <a href="http://www.lornajane.net/posts/2010/Three-Ways-to-Make-a-POST-Request-from-PHP">a new post</a> to her blog looking at three different ways you can make a POST request to a server - cURL, Pecl_Http non-OOP and Pecl_Http with the OOP interface.
</p>
<blockquote>
I've been doing a lot of work with services and working with them in various ways from PHP. There are a few different ways to do this, PHP has a <a href="http://uk.php.net/curl">curl extension</a> which is useful, and if you can add PECL extensions then <a href="http://pecl.php.net/package/pecl_http">pecl_http</a> is a better bet but there are a couple of different ways of using it. This post shows all these side-by-side.
</blockquote>
<p>
Code snippets are included for each showing a request to the <a href="http://flickr.com">Flickr</a> API. Be sure to check out <a href="http://www.lornajane.net/posts/2010/Three-Ways-to-Make-a-POST-Request-from-PHP#comments">the post's comments</a> for more great ideas (like streams, the PEAR HTTP_Client package, Zend_Http_Client and other request types without cURL).
</p>]]></description>
      <pubDate>Tue, 19 Jan 2010 08:45:33 -0600</pubDate>
    </item>
  </channel>
</rss>
