<?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, 19 Jun 2013 12:15:31 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Duckout Blog: Do Funny Stuff with the Google Charts API and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19366</guid>
      <link>http://www.phpdeveloper.org/news/19366</link>
      <description><![CDATA[<p>
In <a href="http://www.duckout.de/programming/do-funny-stuff-with-the-google-charts-api-and-php/">this recent post</a> to the Duckout blog, they show you how to hook your PHP-based (and database driven) application into the Google Charting API for chart/graph generation.
</p>
<blockquote>
I think, whenever we see a chart in a magazine, in books or applications our brain say's to us Yeepie!!! Don't read these stupid texts or tables! Just look at the green or yellow line and hope that they are above the other lines or hope that your opinion is the biggest part of the pie¯. This saves us a lot of work and in my opinion we should concentrate on drawing beautiful colorized pie charts, instead of writing long boring articles. But the question is: ¯How do I draw these beautiful colorized pie charts? The simple answer is: you don't have to, because google will draw them for you and you just have to tell them what to draw via the google charts api.
</blockquote>
<p>
The <a href="https://github.com/Gamma32/breakfast">sample application</a> is a "breakfast rating" tool that logs the results to a MySQL database via PDO calls. The results are then extracted and formated as JSON to be compatible with the Google Charts API data handling. Some sample Javascript is included showing how to call the Charts API with your data and get back a simple line graphing of the data from the database. You can see the application in action <a href="http://breakfast.cloudcontrolled.com/">here</a> for reference.
</p>]]></description>
      <pubDate>Tue, 26 Mar 2013 11:40:44 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jason Fox: Use the Accept Header to Set Your Return Data With Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/19222</guid>
      <link>http://www.phpdeveloper.org/news/19222</link>
      <description><![CDATA[<p>
<i>Jason Fox</i> has a recent post to his site about using <a href="http://neverstopbuilding.net/use-the-accept-header-to-set-your-return-data-with-zend-framework-2/?utm_source=reddit">"Accept" headers in Zend Framework 2 apps</a> to set the format of the return data from a request.
</p>
<blockquote>
In this article I detail the process by which you can set up your controller actions in Zend Framework 2 to return either the default HTML, or JSON data depending on the "Accept Header" in the request. It incorporates changes related to a security update added since this <a href="http://akrabat.com/zend-framework-2/returning-json-using-the-accept-header-in-zf2/">very helpful article</a> was written, and expands on some of the intricacies of making your web layer objects better "json providers."
</blockquote>
<p>
His example uses a "ViewJsonStrategy" and the criteria to look for to determine which version to respond with (HTML or JSON) - the Accept header. It uses the JSON encoder/decoder instead of the built-in PHP one to he could use the included "toJson" method to customize the output of the JSON instead of just returning everything.
</p>]]></description>
      <pubDate>Fri, 22 Feb 2013 11:42:35 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Nitschinger: Benchmarking Cache Transcoders in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19117</guid>
      <link>http://www.phpdeveloper.org/news/19117</link>
      <description><![CDATA[<p>
<i>Michael Nitschinger</i> has written up a new post comparing a few different methods for serializing or translating objects to <a href="http://nitschinger.at/Benchmarking-Cache-Transcoders-in-PHP">store them in a cache</a>. In it, he compares the PHP serializer, the <a href="http://pecl.php.net/package/igbinary">igbinary</a> extension and translation to JSON.
</p>
<blockquote>
Storing PHP objects (or simpler data types like arrays) in caches always requires some kind of transformation. You need a way of encoding/decoding data so that it can be stored and loaded properly. In most languages, this process is known as object <a href="http://en.wikipedia.org/wiki/Serialization">serialization</a>. PHP provides a mechanism for this out of the box, but in this article we'll also look at <a href="http://pecl.php.net/package/igbinary">igbinary</a> as a drop-in replacement for the default serializer. We also compare the results to object transcoding based on <a href="http://json.org/">JSON</a>, which is not really an object serialization mechanism but commonly used as a data chache structure which has its own benefits and drawbacks.
</blockquote>
<p>
He goes through each of the three technologies and includes a snippet of code showing how they'd work in object translation. He also talks about things like the size of the result and the performance of each when the results are looped over. Based on the results of some of his "microbenchmarking" of each of the methods, <a href="http://pecl.php.net/package/igbinary">igbinary</a> came out on top, even faster than PHP's own <a href="http://php.net/serialize">serialize</a>/<a href="http://php.net/unserialize">unserialize</a>.
</p>]]></description>
      <pubDate>Thu, 31 Jan 2013 11:31:01 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Bob Majdak: Apache access logging in JSON format]]></title>
      <guid>http://www.phpdeveloper.org/news/18277</guid>
      <link>http://www.phpdeveloper.org/news/18277</link>
      <description><![CDATA[<p>
<i>Bob Majdak</i> has a quick new post to his site showing you how to <a href="http://catch404.net/2012/07/apache-access-logging-in-json-format/">log messages to Apache</a> using a JSON format instead of the usual single-line information.
</p>
<blockquote>
So this past week I have been doing a lot of logging, parsing, and graphing. I was sitting there wondering what I could do to make the Apache access logs easier to work with. Then it hit me, a brilliant stroke of win: why not format it in JSON? Then in my log parser I could just json_decode it! As far as I know there are no tricks to make Apache do this for you, so really all we have to do is define a custom log format that happens to look like JSON.
</blockquote>
<p>
He includes the "LogFormat" line you'll need to add to your Apache configuration to make it log the JSON and a bit of PHP to help you pull in the file's contents and <a href="http://php.net/json_decode">parse</a> each line.
</p>]]></description>
      <pubDate>Thu, 26 Jul 2012 11:42:02 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Fetching Your Talks from the Joind.In API]]></title>
      <guid>http://www.phpdeveloper.org/news/18075</guid>
      <link>http://www.phpdeveloper.org/news/18075</link>
      <description><![CDATA[<p>
If you're a speaker (or even if you're not and just want to play with the API) and have information on <a href="http://joind.in">Joind.in</a>, <i>Lorna Mitchell</i> has a <a href="http://www.lornajane.net/posts/2012/fetching-your-talks-from-the-joind-in-api">quick way</a> you can pull you information from the site into an easy to use format.
</p>
<blockquote>
I've recently been thinking that I should also do a better job of linking through to the various talks I'm giving/have given - and at around the same time I was contacted by the good folk at mojoLive about integrating against joind.in. To cut a long story short, the joind.in API now has the functionality for users to retrieve their list of talks!
</blockquote>
<p>
Her <a href="http://www.lornajane.net/posts/2012/fetching-your-talks-from-the-joind-in-api">example</a> just uses a <a href="http://php.net/file_get_contents">file_get_contents</a> to pull the data from the remote URL in a JSON format. You don't need to be logged in to get to the talk information, though, so you won't need to bother with OAuth for this one. A snippet to loop through the results is also included.
</p>]]></description>
      <pubDate>Mon, 11 Jun 2012 08:31:30 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Nitschinger's Blog: Handling JSON like a boss in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/18057</guid>
      <link>http://www.phpdeveloper.org/news/18057</link>
      <description><![CDATA[<p>
<i>Michael Nitschinger</i> has a new post to his blog about <a href="http://nitschinger.at/Handling-JSON-like-a-boss-in-PHP">JSON handling</a> in PHP and how to work with it "like a boss".
</p>
<blockquote>
There are already lots of tutorials out there on handling JSON with PHP, but most of them don't go much deeper than throwing an array against json_encode and hoping for the best. This article aims to be a solid introduction into JSON and how to handle it correctly in combination with PHP. Also, readers who don't use PHP as their programming language can benefit from the first part that acts as a general overview on JSON.
</blockquote>
<p>
He starts with an introduction to JSON - what it is and what a typical structure looks like. He moves into how to encode JSON in PHP using <a href="http://php.net/manual/en/function.json-encode.php">json_encode</a>, showing teh result of encoding things like arrays, strings and associative arrays. He also includes a bit on translating an object and the resulting JSON string. He mentions the options bitmasks, shows how to decode JSON you're given and talks about error handling and testing of the results.
</p>]]></description>
      <pubDate>Thu, 07 Jun 2012 09:13:58 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: Returning JSON using the Accept header in ZF2]]></title>
      <guid>http://www.phpdeveloper.org/news/17756</guid>
      <link>http://www.phpdeveloper.org/news/17756</link>
      <description><![CDATA[<p>
In a <a href="http://phpdeveloper.org/news/17748">previous post</a> <i>Rob Allen</i> showed how to return JSON data from a controller in a Zend Framework 2 application. In <a href="http://akrabat.com/zend-framework-2/returning-json-using-the-accept-header-in-zf2/">this new post</a> he shows how to use the "Accepts" header from the client to do the same thing.
</p>
<blockquote>
Following yesterday's article on <a href="http://akrabat.com/zend-framework-2/returning-json-from-a-zf2-controller-action/">returning JSON from a ZF2 controller action</a>, <a href="http://twitter.com/lsmith">Lukas</a> suggested that I should also demonstrate how to use the Accept header to get JSON. So this is how you do it!
</blockquote>
<p>
You'll need to <a href="http://akrabat.com/zend-framework-2/returning-json-from-a-zf2-controller-action/">create the JsonStrategy</a> first, then you can return the ViewModel from the controller. If all goes well, you should see the sample HTML page rendered in a browser and JSON output when requested with the right "Accept" header (he uses curl in his example).
</p>]]></description>
      <pubDate>Fri, 30 Mar 2012 08:01:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: Returning JSON from a ZF2 controller action]]></title>
      <guid>http://www.phpdeveloper.org/news/17748</guid>
      <link>http://www.phpdeveloper.org/news/17748</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Rob Allen</i> shows how you can return JSON data <a href="http://akrabat.com/zend-framework-2/returning-json-from-a-zf2-controller-action/">directly back from a controller</a> in a Zend Framework 2 application.
</p>
<blockquote>
The new view layer in Zend Framework 2 can be set up to return JSON rather than rendered HTML relatively easily. [...] Firstly we need to set up the view's JsonStrategy to check to a situation when returning JSON is required and then to render out JSON for us.
</blockquote>
<p>
This "JsonStrategy" does some of the hard work for you - detecting when the client is requesting a JSON response and looking at the data coming into the view to see if it's JSON. He shows how to implement it in a sample module using the "onBootstrap" module and how to force a return of the JsonModel even when JSON isn't requested (useful for a consistent interface).
</p>]]></description>
      <pubDate>Thu, 29 Mar 2012 08:55:39 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Konr Ness' Blog: Zend_Config Benchmark - JSON, Array, INI, XML, YAML]]></title>
      <guid>http://www.phpdeveloper.org/news/17647</guid>
      <link>http://www.phpdeveloper.org/news/17647</link>
      <description><![CDATA[<p>
In <a href="http://konrness.com/php5/zend_config-benchmark-json-array-ini-xml-yaml/">this recent post</a> to his blog, <i>Konr Ness</i> has benchmarked the components that the Zend Framework uses to read in different types of configuration files - JSON, native PHP arrays, INI, XML and YAML files.
</p>
<blockquote>
If you application relies on parsing one or several config files each time it is bootstrapped it is important that you select a file format that is fast to parse. But you also want to select a config file format that is easy for a human to read and edit. In a recent application I am building I also had the need to write modifications to config files, so I also benchmarked the Zend_Config_Writer components.
</blockquote>
<p>
He includes both the sample configuration INI file and the benchmarking script he used to measure the results (all configurations were read from external files, even the native PHP option). His results were pretty predictable (with the exception of YAML reading) with the standard INI file coming in second to the native PHP arrays, but having the advantage of being more readable.
</p>]]></description>
      <pubDate>Thu, 08 Mar 2012 11:51:32 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Slawek Lukasiewicz's Blog: New Features in PHP 5.4 - JSON Extension & header_register_callback]]></title>
      <guid>http://www.phpdeveloper.org/news/17624</guid>
      <link>http://www.phpdeveloper.org/news/17624</link>
      <description><![CDATA[<p>
In the first two posts of his "features new to PHP 5.4" series <i>Slawek Lukasiewicz</i> has posted about two things that weren't mentioned very often in most of the 5.4 hit lists - improvements to the JSON extension and the header_register_callback method.
</p>
<p>About the <a href="http://www.leftjoin.net/2012/03/php-5-4-json-extension-improvements/">JSON extension improvements</a>:
</p>
<blockquote>
By default, when we pass object to json_encode function, it will return JSON representation of object public properties. [...] PHP 5.4 introduces JsonSerializable interface with JsonSerialize abstract method. After implementing this method we can independently set values used in JSON representation.
</blockquote>
<p>Related to the <a href="http://www.leftjoin.net/2012/03/php-5-4-header_register_callback/">header_register_callback addition</a>
</p>
<blockquote>
After looking at new functions introduced in PHP 5.4 we can found one called <a href="http://www.php.net/manual/en/function.header-register-callback.php">header_register_callback</a>. Using it, we can register callback which will be called before sending output.
</blockquote>
<p>
The stable version of PHP 5.4 has officially been released, so <a href="http://php.net/downloads">get out there and grab it</a> and start using these new features now!
</p>]]></description>
      <pubDate>Mon, 05 Mar 2012 10:16:20 -0600</pubDate>
    </item>
  </channel>
</rss>
