<?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, 23 May 2012 04:49:14 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Using SPL Iterators, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/17962</guid>
      <link>http://www.phpdeveloper.org/news/17962</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial posted, the first part of a series, looking at the use of the <a href="http://php.net/spl">Standard PHP Library (SPL)</a> in PHP. In <a href="http://phpmaster.com/using-spl-iterators-1/">this first part</a> of the series, <i>Stefan Froelich</i> looks specifically at two of the more common uses for iterators - working with arrays and directories.
</p>
<blockquote>
When I first came across the term iteration and saw the overwhelming list of classes related to it in the SPL, I was taken aback. It seemed maybe iteration was too complex for me to grasp. I soon realized it was just a fancy word for something we programmers do all the time. [...] In the first part of this two-part series I'll introduce you to iteration and how you can take advantage of some of the built-in classes from the Standard PHP Library (SPL).
</blockquote>
<p>
Included in the tutorial is example code showing how to use the <a href="http://php.net/arrayiterator">ArrayIterator</a> to work with an array and the <a href="http://php.net/directoryiterator">DirectoryIterator</a> to process the contents of a directory. He also briefly touches on a few other iterators like "FileExtensionFilter", "RecursiveDirectoryIterator" and "RecursiveArrayIterator".
</p>]]></description>
      <pubDate>Tue, 15 May 2012 12:26:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Larry Garfield's Blog: readfile() not considered harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/17909</guid>
      <link>http://www.phpdeveloper.org/news/17909</link>
      <description><![CDATA[<p>
In <a href="http://www.garfieldtech.com/blog/readfile-memory">this new post</a> to his blog <i>Larry Garfield</i> tries to dispel a common misconception in the PHP development world - that the <a href="http://php.net/readfile">readfile</a> function should be considered harmful and can cause memory issues in your code.
</p>
<blockquote>
If you're like me, you've probably read a dozen or two articles about PHP performance in your career. Many of them are quite good, but some are simply flat out wrong, or misinformed. One of the old truisms that has been repeated for as long as I can recall is "don't use readfile() if you have big files, because it reads the whole file into memory and your server will explode." [...] There's just one problem with that age-old truism: It's not true.
</blockquote>
<p>
He created some benchmarks to illustrate the differences between several of the common methods for working with files via the <a href="http://php.net/fread">fread</a>, <a href="http://php.net/fpassthru">fpassthru</a>, <a href="http://php.net/stream_copy_to_stream">stream_copy_to_stream</a> and of course <a href="http://php.net/readfile">readfile</a>. He reports the results based on the runtime and the peak memory usage and noted, ironically, that while the times varied slightly, the memory consumption was exactly the same for all of the approaches. Since there's no real reason not to use "readfile", he looks at three reasons why there might be this stigma attached to it (including the issues that could come up with output buffering enabled).
</p>]]></description>
      <pubDate>Fri, 04 May 2012 09:51:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Working with Files in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17858</guid>
      <link>http://www.phpdeveloper.org/news/17858</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial that shows you some examples of <a href="http://phpmaster.com/working-with-files-in-php/">working with files</a> and the local file system in your PHP applications.
</p>
<blockquote>
You may well be familiar with databases such as MySQL and Access which are an ever-increasingly common means of storing data. But data is also stored in files, like Word documents, event logs, spreadsheets, image files, and so on. Databases generally require a special query language to retrieve information, whereas files are 'flat' and usually appear as a stream of text. [...] PHP provides a range of functions which allow you to work with files, and in this article I'll demonstrate some of them for you.
</blockquote>
<p>
Examples in the article include the use of several of the PHP file functions including: <a href="http://php.net/filesize">filesize</a>, <a href="http://php.net/filectime"> filectime</a>, <a href="http://php.net/is_readable"> is_readable</a>, <a href="http://php.net/file_put_contents"> file_put_contents</a> and <a href="http://php.net/fopen"> fopen</a>. There's also an example of using the CSV file functions for working with a comma-separated file (both in reading and writing).
</p>]]></description>
      <pubDate>Tue, 24 Apr 2012 10:05:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Code2Learn.com: Generating CSV file using CodeIgniter Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/17841</guid>
      <link>http://www.phpdeveloper.org/news/17841</link>
      <description><![CDATA[<p>
The Code2Learn site has posted another in their CodeIgniter "series" about producing various kinds of output from an application based on this framework. In <a href="http://www.code2learn.com/2012/03/generating-csv-file-using-codeigniter.html">this new article</a> <i>Farhan Khwaja</i> shows how to output a CSV-formatted file.
</p>
<blockquote>
I have already written posts on <a href="http://www.code2learn.com/2012/02/generating-pdf-files-from-database.html">how to generate pdf files using CodeIgniter Framework</a> and also on <a href="http://www.code2learn.com/2012/03/generating-tabulated-pdf-file-from.html">how to generate tabulated pdf file using CodeIgniter Framework</a>.  This post will help you to generate a CSV file using CodeIgniter. The data for the CSV File will be taken from the MySQL Database and will be put into the CSV File.
</blockquote>
<p>
He includes the source for a basic "Generate" controller class that uses a custom "CSV_Helper" to do the work. It has two methods - one to transform array data and another to take the database result object and extract each record. 
</p>]]></description>
      <pubDate>Thu, 19 Apr 2012 11:45:52 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Phil Sturgeon's Blog: Hijacking Headers to Force Downloads]]></title>
      <guid>http://www.phpdeveloper.org/news/17751</guid>
      <link>http://www.phpdeveloper.org/news/17751</link>
      <description><![CDATA[<p>
<i>Phil Sturgeon</i> shows how you can <a href="http://philsturgeon.co.uk/blog/2012/03/hijacking-headers-to-force-downloads">hijack headers</a> in his latest post to force a download to the client (even on a hosted service like <a href="http://pagodabox.com">PagodaBox</a>).
</p>
<blockquote>
The question [I posed on Twitter] was: "How to force a download of any file of any type, not on your server, without Apache tweaking? Images are displaying and need em to download." Essentially, I wanted to be able to link to a file that was not on the server in question and anywhere in the world, which could be of any size, any media type and could be potentially very high traffic.
</blockquote>
<p>
Answers varied from using <a href="http://php.net/readfile">readfile</a> to just letting the browser handle it. None of the responses were quick right until he came across one that recommended some settings in an .htaccess file. It uses <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html>mod_rewrite</a> (Apache) to redirect the user to a new resource while adding a "Content-Disposition" header in the process (of "attachment").
</p>]]></description>
      <pubDate>Thu, 29 Mar 2012 11:29:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: How to use eval() without using eval() in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17665</guid>
      <link>http://www.phpdeveloper.org/news/17665</link>
      <description><![CDATA[<p>
In <a href="http://gonzalo123.wordpress.com/2012/03/12/how-to-use-eval-without-using-eval-in-php/">this new post</a> <i>Gonzalo Ayuso</i> talks about "using eval without using eval" in PHP applications - executing PHP code without having to use the <a href="http://php.net/eval">eval</a> function to do it.
</p>
<blockquote>
Yes I know. Eval() is evil. If our answer is to use <a href="http://php.net/manual/en/function.eval.php">eval()</a> function, we are probably asking the wrong question. When we see an eval() function all our coding smell's red lights start flashing inside our mind. Definitely it's a bad practice. But last week I was thinking about it. How can I eval raw PHP code without using the eval function, and I will show you my outcomes.
</blockquote>
<p>
He includes some sample code showing a basic script with a class and a loop executing normally, then an "eval version" that puts it all in a string and executes it. He offers a different method - not an ideal one since it requires being able to write to the local file system, but prevents the need for eval - writing the PHP code to a temporary file and using a "fake eval" to <a href="htttp://php.net/include">pull it in</a>.
</p>]]></description>
      <pubDate>Tue, 13 Mar 2012 10:09:52 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Robert Basic's Blog: Zend Framework full page cache tips]]></title>
      <guid>http://www.phpdeveloper.org/news/17533</guid>
      <link>http://www.phpdeveloper.org/news/17533</link>
      <description><![CDATA[<p>
If you're looking at using the full-page caching that the Zend Framework has to offer, you should <a href="http://robertbasic.com/blog/zend-framework-full-page-cache-tips">read about Robert Basic's experiences</a> with it before implementing it in your application.
</p>
<blockquote>
When I started rewriting this blog, I knew from start that I want to use Zend Framework's full page caching, as, I think, that's the best cache for this purpose. Not much going on on the front end, much more reads than writes, no ajax or any other "dynamic" content. While implementing the cache, I ran into two issues.
</blockquote>
<p>
His issues revolved around the feature not creating valid cache files due to a duplicate "startSession" call in his code and having the Google Analytics code included in the template (with different keys every time). You can find out more about this functionality <a href="http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.page">in the Zend Framework manual</a>. 
</p>]]></description>
      <pubDate>Mon, 13 Feb 2012 11:45:10 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: PHP Closures as View Helpers: Lazy-Loading File Data]]></title>
      <guid>http://www.phpdeveloper.org/news/17466</guid>
      <link>http://www.phpdeveloper.org/news/17466</link>
      <description><![CDATA[<p>
In the second part of their look at using closures in PHP as view helpers, DevShed improves upon <a href="http://phpdeveloper.org/news/17446">their original code</a> by adding some additional classes and <a href="http://www.devshed.com/c/a/PHP/PHP-Closures-as-View-Helpers-LazyLoading-File-Data/">using them in the closures</a>.
</p>
<blockquote>
The best way to show you how using anonymous functions can help you to develop more efficient OO applications is with some functional, hands-on examples. With this idea in mind, in the installment that preceded this one, I implemented an extendable template system. This system could spawn view objects and render the template files associated with these objects.
</blockquote>
<p>
In this second part of the (two-part) series they include "Serializer" and "FileHandler" classes and show how to use them inside of the closures to lazy-load in data from an external file and work with it as serialized content.
</p>]]></description>
      <pubDate>Mon, 30 Jan 2012 13:08:28 -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[PHPMaster.com: A Tour of PHP.INI]]></title>
      <guid>http://www.phpdeveloper.org/news/17243</guid>
      <link>http://www.phpdeveloper.org/news/17243</link>
      <description><![CDATA[<p>
On PHPMaster.com today <i>Callum Hopkins</i> has <a href="http://phpmaster.com/a-tour-of-php-ini/">written up an introduction to the php.ini</a>, the heart and soul of any PHP installation. With configuration options for just about everything, it can be confusing. This tutorial hits some of the highs and most commonly updated settings.
</p>
<blockquote>
Anyone who has a server using PHP has undoubtedly heard of php.ini - it's the configuration file used to control and customize PHP's run-time behavior. It provides a simple way to configure settings. [...] In this article I'll give an overview of some important settings I believe you should be concerned with when tweaking your own php.ini file.
</blockquote>
<p>The tutorial's broken up into a few different topics:</p>
<ul>
<li>the PHP engine
<li>Short tags
<li>Output buffering
<li>Automatic headers and footers
<li>Handling errors
<li>Time zones
</ul>]]></description>
      <pubDate>Mon, 12 Dec 2011 10:42:45 -0600</pubDate>
    </item>
  </channel>
</rss>

