<?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, 21 May 2012 07:49:36 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Till Klampaeckel's Blog: PHAR and FreeBSD]]></title>
      <guid>http://www.phpdeveloper.org/news/17101</guid>
      <link>http://www.phpdeveloper.org/news/17101</link>
      <description><![CDATA[<p>
<i>Till Klampaeckel</i> has a new post about <a href="http://till.klampaeckel.de/blog/archives/172-PHAR-and-FreeBSD.html">replacing the now-missing phar port</a> on FreeBSD installations with a custom compile work-around.
</p>
<blockquote>
I noticed that archivers/pecl-phar vanished from the ports tree on one of my FreeBSD servers.
Problem? Reasons to remove the port were: the port is unmaintained, the port was based on the outdated phar extension from pec and that phar (in pecl) contains open security issues. The simple solution is to create a new port which of course will use the phar which is bundled in PHP's core.
</blockquote>
<p>
He includes the simple five or six step process you'll need to follow to compile your own phar extension for your installation - grabbing the latest source, compiling (configure/make) and putting the resulting shared object (.so) in the right place for PHP to find it. All that's left then is to enable it in the php.ini. <a href="http://php.net/phar">Phar</a> is an archive creation tool that (normally) comes bundled with versions of PHP and can be used to both read and write to compressed packages.
</p>]]></description>
      <pubDate>Tue, 08 Nov 2011 11:51:58 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ZendCasts.com: Fun with Phar]]></title>
      <guid>http://www.phpdeveloper.org/news/16944</guid>
      <link>http://www.phpdeveloper.org/news/16944</link>
      <description><![CDATA[<p>
New today on ZendCasts.com there's a screencast tutorial about <a href="http://www.zendcasts.com/fun-with-phar/2011/10/">using phar archives</a> in your applications. 
</p>
<blockquote>
Phar is a new thing that's developed on the horizon over the last few years that's essentially a PHP archive or library.
</blockquote>
<p>
He shows how to set up a basic application (non-Zend Framework) that does a "hello world" sort of output showing a date "next week". Also included are the commands to bundle it up into a phar archive using the <a href="http://php.net/phar">features already built into PHP</a>. The build stub uses the <a href="http://php.net/buildFromDirectory">buildFromDirectory</a> and compression/buffering. He also points out a common problem with the default settings on many PHP installed - an INI setting that disables phar creation. Thankfully, it's easy to change via a <a href="http://php.net/ini_set">ini_set</a> call updating the "phar.readonly" setting.
</p>]]></description>
      <pubDate>Tue, 04 Oct 2011 08:14:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Josh Adell's Blog: Phar Flung Phing]]></title>
      <guid>http://www.phpdeveloper.org/news/16906</guid>
      <link>http://www.phpdeveloper.org/news/16906</link>
      <description><![CDATA[<p>
<i>Josh Adell</i> has posted about a bit of automation he set up with <a href="http://phing.info">Phing</a> and PHP's <a href="http://php.net/phar">phar</a> packaging to create an archive as a part of his build system. It's a <a href="http://blog.everymansoftware.com/2011/09/phar-flung-phing.html">simple five step process</a> mad even easier by the fact that Phing already has a PharPackage task.
</p>
<blockquote>
One of the cooler features of PHP 5.3 is the ability to package up a set of PHP class files and scripts into a single archive, known as a PHAR ("PHp ARchive"). [...]  I decided to see how easy it would be to wrap up <a href="http://github.com/jadell/Neo4jPHP">Neo4jPHP</a> in a PHAR for distribution. [...] Since I also started playing with Phing recently, I decided to see if I could incorporate packaging a project as a PHAR into my build system. It turns out, it's pretty easy, given that Phing has a built-in PharPackage task.
</blockquote>
<p>
He points you towards Phing's PEAR channel to get the tool installed and includes a command-line call to update your php.ini to allow PHP to generate phar files. Code is included to create the phar-generation stub as well as the XML for the Phing build file. You can find his <a href="http://github.com/downloads/jadell/Neo4jPHP/neo4jphp.phar">end result here</a>.
</p>]]></description>
      <pubDate>Mon, 26 Sep 2011 10:05:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Phar: PHP libraries included with a single file]]></title>
      <guid>http://www.phpdeveloper.org/news/16900</guid>
      <link>http://www.phpdeveloper.org/news/16900</link>
      <description><![CDATA[<p>
On DZone.com today <i>Giorgio Sironi</i> has a new post looking at an interesting, if seldom used, feature of recent PHP releases - <a href="http://css.dzone.com/articles/phar-php-libraries-single-file">packaging applications with phar archives</a>.
</p>
<blockquote>
<a href="http://php.net/phar">Phar</a> is a php extensions that provides the means for distributing code as a single archive, that does not have to be extracted to a folder before usage. The concept is similar to JVM Jars: each archive becomes a virtual directory where files can be accessed. However, the virtual folder is not limited to class loading, but you can open and read internal files as if it were decompresse into a directory.
</blockquote>
<p>
He includes a brief "hello world" example of packaging up a script into a phar archive and executing it via PHP. He also shows how easy it is to create an archive from current code, making an archive containing the latest Doctrine 2 release for simple inclusion. Phars also allow compression and hashing but has issues with resource management and access external files.
</p>]]></description>
      <pubDate>Fri, 23 Sep 2011 11:30:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christian Weiske's Blog: Working with .phar files]]></title>
      <guid>http://www.phpdeveloper.org/news/16777</guid>
      <link>http://www.phpdeveloper.org/news/16777</link>
      <description><![CDATA[<p>
<i>Christian Weiske</i> has a new post to his blog looking at a feature of PHP that's very useful yet doesn't seem to be widely used - <a href="http://php.net/phar">phar archives</a>. His post <a href="http://cweiske.de/tagebuch/php-phar-files.htm">introduces you to phar</a> and includes the good and the bad about their use.
</p>
<blockquote>
It is possible to pack an entire PHP web application up in one single file and run it without unpacking it. This files usually have a .phar extension, which is an acronym for PHp ARchive, loosely based on jar (Java ARchive). [...] With PHP 5.3.0, the <a href="http://php.net/phar">Phar extension</a> is an official part of PHP. Shipping your applications as Phar thus is safe since 5.2 has reached its EOL already.
</blockquote>
<p>
He mentions some of the pros (like one file, no unpacking needed) and cons (like no method for incremental updates, changing individual files inside the package is hard) of using them. He also talks about some of the tools you can use to create your own packages including PHP's own support, <a href="http://github.com/koto/phar-util">phar-util</a> and <a href="http://phing.info">Phing's phar task</a>. He includes a few "things to consider" when making your packages and gives examples from the <a href="http://semanticscuttle.sourceforge.net/">SemanticShuttle</a> package to illustrate. Thrown in at the end are some benchmarks that show the difference between static file serving (with and without PHP) and the same sort of statistics with Phar packages included in the mix.
</p>]]></description>
      <pubDate>Fri, 26 Aug 2011 09:07:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Script-Tutorials.com: Phar - PHP archiving practice]]></title>
      <guid>http://www.phpdeveloper.org/news/16343</guid>
      <link>http://www.phpdeveloper.org/news/16343</link>
      <description><![CDATA[<p>
On Script-Tutorials.com today there's a new tutorial showing you how to use one of the more under-used and powerful features of recent PHP releases - the <a href="http://www.script-tutorials.com/phar-php-archiving-practice/">phar packaging for creating self-contained archives</a>.
</p>
<blockquote>
I guess you noticed that due your project become larger - the more and more files it contain. Sometimes it comes to the thousands of files. And then - Phar can help you. This utility allows us to pack a variety of files in the single library file. Thus, we can significantly reduce the number of include files in the project, and work with the entire library as with single file. It is also possible to have a packed (gzip/bzip2) version of the library.
</blockquote>
<p>
They show you how to create simple phar archive (<a href="http://www.script-tutorials.com/demos/75/source.zip">sample code here</a>) that contains a few classes linked by an index.php file. 
</p>]]></description>
      <pubDate>Tue, 17 May 2011 08:28:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Wojciech Sznapka's Blog: Power of PHP streams - decompress gz archives on the fly from remote server]]></title>
      <guid>http://www.phpdeveloper.org/news/15482</guid>
      <link>http://www.phpdeveloper.org/news/15482</link>
      <description><![CDATA[<p>
<i>Wojciech Sznapka</i> has <a href="http://blog.sznapka.pl/power-of-the-php-streams-decompress-gz-archives-on-the-fly-from-remote-server/">a new post to his blog</a> today looking at the "power of PHP streams" and how they can be used to decompress gzipped data from remote servers.
</p>
<blockquote>
Probably most of us heard about streams in PHP. They are background of all files and network operations in PHP, even if we don't see it. Everytime when you use file_get_contents or fopen you are actually using streams. But there are many stream wrappers I haven't used, because they aren't well known.One of them is compress.zlib (and two other <a href="http://www.php.net/manual/en/wrappers.compression.php">compression stream filters</a>). 
</blockquote>
<p>
He includes a quick example (because, thankfully, that's all working with streams like this usually requires) about pulling in a file from his server and uses the stream to fetch and unzip the data to display the contents.
</p>]]></description>
      <pubDate>Wed, 24 Nov 2010 08:39:05 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Working with Zip Archives in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/14309</guid>
      <link>http://www.phpdeveloper.org/news/14309</link>
      <description><![CDATA[<p>
On PHPBuilder.com today <i>Octavia Anghel</i> has written up a tutorial about <a href="http://www.phpbuilder.com/columns/Octavia_Anghel040610.php3">working with zip archive files</a> directly from PHP. The key is the <a href="http://www.php.net/manual/en/book.zip.php">Zip Archive extension</a> that you can <a href="http://pecl.php.net/package/zip">get from the PECL repository</a> if you have a version older than PHP 5.2. Those on PHP 5.2 or higher already have it bundled in.
</p>
<blockquote>
I explain how to manage Zip archive files in PHP using a number of <a href="http://www.phpbuilder.com/columns/php_zip_code.zip">demo PHP applications</a>. You'll learn how to create Zip archives, add files and folders inside the archive from a string and from a given path, delete and rename files using their indexes and names and list the ZipArchive object details (number of files, filenames, comments, statusSys, etc.).
</blockquote>
<p>
Complete code for the examples (along with a few screenshots) are included in the tutorial as well as <a href="http://www.phpbuilder.com/columns/php_zip_code.zip">a link to download the source</a> to get you started even faster.
</p>]]></description>
      <pubDate>Wed, 07 Apr 2010 08:44:54 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Johannes Schluter's Blog: Searching through archive files]]></title>
      <guid>http://www.phpdeveloper.org/news/13184</guid>
      <link>http://www.phpdeveloper.org/news/13184</link>
      <description><![CDATA[<p>
Recently <i>Johannes Schluter</i> <a href="http://schlueters.de/blog/archives/118-Searching-through-archive-files.html">wrote up a post</a> on searching through archived files (like .tar.gz or .bzip) to perform a full-text search on their contents:
</p>
<blockquote>
As said the app is about browsing the PHP manual. The manual is provided as tar.gz to the app and I wanted to have a fulltext search. For accessing the tar.gz content I'm using phar. Yes, phar is not only for phar files but can work on different kinds of archives (tar.gz, tar.bz2, zip), too.
</blockquote>
<p>
In <a href="http://schlueters.de/blog/archives/118-Searching-through-archive-files.html">the code</a> he uses Iterators and a <a href="http://us.php.net/manual/en/class.PharData.php">PharData</a> instance to open and search the contents of the given file. He explains how it all works, too, as well as mentioning a few places where it might need a bit of work.
</p>]]></description>
      <pubDate>Tue, 08 Sep 2009 12:12:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zoe Slattery's Blog: So phar so good]]></title>
      <guid>http://www.phpdeveloper.org/news/11730</guid>
      <link>http://www.phpdeveloper.org/news/11730</link>
      <description><![CDATA[<p>
In a <a href="http://zoomsplatter.blogspot.com/2009/01/so-phar-so-good.html">recent post</a> to her blog <i>Zoe Slattery</i> looks at a way to provide users with a single-file approach to installing an application. Her choice was <a href="http://us.php.net/phar">phar</a>.
</p>
<blockquote>
I've just finished converting a small procedural application, designed to be run from the command line, to PHP5 . I wanted a way to give users a single file to execute and as phar is included in PHP5.3 I decided to try to use it.
</blockquote>
<p>
She includes the tree structure for the application and steps through the process she used to make the archive - a call to buildFromDirectory, making a new phar object, adding the contents of files into it and building out a stub that maps the command-line call on the archive to a certain script.
</p>]]></description>
      <pubDate>Tue, 13 Jan 2009 11:11:54 -0600</pubDate>
    </item>
  </channel>
</rss>

