<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Glen Scott - Keeping it simple &#187; php</title>
	<atom:link href="http://www.glenscott.co.uk/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.glenscott.co.uk</link>
	<description>Thoughts on application development and other geeky pursuits.</description>
	<lastBuildDate>Sat, 17 Jul 2010 16:59:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Install memcached PHP extension on OS X Snow Leopard</title>
		<link>http://www.glenscott.co.uk/2009/08/30/install-memcached-php-extension-on-os-x-snow-leopard/</link>
		<comments>http://www.glenscott.co.uk/2009/08/30/install-memcached-php-extension-on-os-x-snow-leopard/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 15:54:21 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[snowleopard]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=424</guid>
		<description><![CDATA[memcached is a very useful memory object caching system, which can be used to increase the performance of your dynamic scripts by caching database calls.
This guide will explain how to install the memcached system, including the PHP extension, on Mac OS X 10.6.
Xcode
The Xcode package installs the necessary versions of tools like autoconf which is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.danga.com/memcached/">memcached</a> is a very useful memory object caching system, which can be used to increase the performance of your dynamic scripts by caching database calls.</p>
<p>This guide will explain how to install the memcached system, including the PHP extension, on Mac OS X 10.6.</p>
<h3>Xcode</h3>
<p>The Xcode package installs the necessary versions of tools like autoconf which is needed during the PHP extension compilation process.  Make sure you have Xcode 3.2 installed;  the install package is available on the Snow Leopard install DVD under the &#8220;Optional Installs&#8221; folder.</p>
<h3>libevent</h3>
<p><a href="http://www.monkey.org/~provos/libevent/">libevent</a> is a pre-requisite for memcached.</p>
<ul>
<li><code>cd /tmp; curl -O http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz</code></li>
<li><code>tar zxvf libevent-1.4.12-stable.tar.gz</code></li>
<li><code>cd libevent-1.4.12-stable</code></li>
<li><code>./configure; make</code></li>
<li><code>sudo make install</code></li>
</ul>
<h3>memcached</h3>
<p><a href="http://www.danga.com/memcached/download.bml">memcached</a> is the daemon responsible for actually storing and retrieving arbitrary objects for your applications.</p>
<ul>
<li><code>cd /tmp; curl -O http://memcached.googlecode.com/files/memcached-1.4.1.tar.gz</code></li>
<li><code>tar zxvf memcached-1.4.1.tar.gz</code></li>
<li><code>cd  memcached-1.4.1</code></li>
<li><code>./configure; make</code></li>
<li><code>sudo make install</code></li>
</ul>
<h3>libmemcached</h3>
<p><a href="http://freshmeat.net/projects/libmemcached">libmemcached</a> is the shared library that will allow clients, in this case PHP, access the memcached daemon.</p>
<ul>
<li>Download libmemcached, move to <code>/tmp</code> and unpack</li>
<li><code>cd libmemcached-0.31</code></li>
<li><code>./configure; make</code></li>
<li><code>sudo make install</code></li>
</ul>
<h3>php extension</h3>
<p>Now we are ready to prepare the PHP extension to memcached, which is available from <a href="http://pecl.php.net">pecl</a>.</p>
<ul>
<li><code>cd /tmp; pecl download memcached</code></li>
<li><code>gzip -d < memcached-1.0.0.tgz | tar -xvf -</code></li>
<li><code>cd memcached-1.0.0; phpize</code></li>
</ul>
<p>You should see output similar to the following:<br />
<code><br />
Configuring for:<br />
PHP Api Version:         20090626<br />
Zend Module Api No:      20090626<br />
Zend Extension Api No:   220090626<br />
</code></p>
<ul>
<li><code>./configure; make</code></li>
<li><code>sudo make install</code></li>
</ul>
<p>On a successful install, you will get the following message:</p>
<p><code>Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20090626/</code></p>
<p>Modify your <code>php.ini</code> configuration file and make sure you have the following line included:</p>
<p><code>extension = memcached.so</code></p>
<p>You can then restart your Apache server:</p>
<ul>
<li><code>sudo apachectl restart</code></li>
</ul>
<p>to make the memcached functionality available in your scripts.</p>
<p><a href="/images/memcached-php.png"><img src="/images/memcached-php-med.png" width="450" height="140" alt="memcached php extension" border="0"></a></p>
<h3>References</h3>
<ul>
<li><a href="http://php.net/manual/en/install.pecl.phpize.php">Compiling shared PECL extensions with phpize</a></li>
<li><a href="http://php.net/memcached">PHP: Memcached - Manual</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2009%2F08%2F30%2Finstall-memcached-php-extension-on-os-x-snow-leopard%2F&amp;linkname=Install%20memcached%20PHP%20extension%20on%20OS%20X%20Snow%20Leopard"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2009/08/30/install-memcached-php-extension-on-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Fix PHP timezone warnings in OS X Snow Leopard</title>
		<link>http://www.glenscott.co.uk/2009/08/30/fix-php-timezone-warnings-in-os-x-snow-leopard/</link>
		<comments>http://www.glenscott.co.uk/2009/08/30/fix-php-timezone-warnings-in-os-x-snow-leopard/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 09:07:30 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[snowleopard]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=417</guid>
		<description><![CDATA[The standard Mac install of PHP has always been somewhat quirky, and 10.6 is no exception.  One of the most obvious issues occurs when attempting to use date/time functions.  PHP 5.3 requires that the date.timezone setting is available.  Without this, you will receive a warning similar to the following:
Warning: getdate() [function.getdate]: It [...]]]></description>
			<content:encoded><![CDATA[<p>The standard Mac install of PHP has always been somewhat quirky, and 10.6 is no exception.  One of the most obvious issues occurs when attempting to use <a href="http://php.net/manual/en/ref.datetime.php">date/time functions</a>.  PHP 5.3 requires that the <a href="http://php.net/manual/en/datetime.configuration.php#ini.date.timezone">date.timezone</a> setting is available.  Without this, you will receive a warning similar to the following:</p>
<p><code>Warning: getdate() [function.getdate]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for 'BST/1.0/DST' instead in /Users/gscott/Sites/hello-world.php on line 9</code></p>
<p>The solution is to edit (or create, if it doesn&#8217;t exist) <code>/private/etc/php.ini</code> and make sure a setting exists for <code>date.timezone</code>.  For example:</p>
<p>    date.timezone = Europe/London</p>
<p>After making the change, restart Apache</p>
<p>    sudo apachectl restart</p>
<ul>
<li><a href="http://php.net/manual/en/timezones.php">List of supported timezones</a>.
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2009%2F08%2F30%2Ffix-php-timezone-warnings-in-os-x-snow-leopard%2F&amp;linkname=Fix%20PHP%20timezone%20warnings%20in%20OS%20X%20Snow%20Leopard"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2009/08/30/fix-php-timezone-warnings-in-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP 5.3: The Good, the Bad and the Ugly</title>
		<link>http://www.glenscott.co.uk/2009/06/30/php-53-the-good-the-bad-and-the-ugly/</link>
		<comments>http://www.glenscott.co.uk/2009/06/30/php-53-the-good-the-bad-and-the-ugly/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 21:55:20 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=405</guid>
		<description><![CDATA[PHP 5.3 was released today;  here are my positive and negatives:
The Good:  Closures
Anonymous functions created with create_function have always been a bit messy.  With 5.3 comes support for closures with a much cleaner syntax:

    $greet = function($name)
    {
        printf("Hello [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://php.net/releases/5_3_0.php">PHP 5.3</a> was released today;  here are my positive and negatives:</p>
<h3>The Good:  Closures</h3>
<p>Anonymous functions created with <a href="http://php.net/create_function">create_function</a> have always been a bit messy.  With 5.3 comes support for closures with a much cleaner syntax:</p>
<pre name="code" class="php">
    $greet = function($name)
    {
        printf("Hello %s\r\n", $name);
    };

    $greet('World');
    $greet('PHP');
</pre>
<h3>The Bad:  Backwards incompatible changes</h3>
<p>Although not a massive change from 5.2, there are enough <a href="http://php.net/manual/en/migration53.incompatible.php">differences to break existing code</a>.</p>
<h3>The Ugly:  Namespaces</h3>
<p>There has been <a href="http://blog.fedecarg.com/2008/10/28/php-namespaces-controversy/">quite a discussion</a> about PHP&#8217;s new namespace syntax.  </p>
<pre name="code" class="php">$c = new \my\name\MyClass;</pre>
<p>It&#8217;s just damn ugly.  The more sensible choice, <code>::</code> is already used as the <a href="http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php">scope resolution operator</a> and was therefore dismissed.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2009%2F06%2F30%2Fphp-53-the-good-the-bad-and-the-ugly%2F&amp;linkname=PHP%205.3%3A%20The%20Good%2C%20the%20Bad%20and%20the%20Ugly"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2009/06/30/php-53-the-good-the-bad-and-the-ugly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mcrypt support for PHP on 64 bit Mac OS X 10.5</title>
		<link>http://www.glenscott.co.uk/2009/03/16/mcrypt-support-for-php-on-64-bit-mac-os-x-105/</link>
		<comments>http://www.glenscott.co.uk/2009/03/16/mcrypt-support-for-php-on-64-bit-mac-os-x-105/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 20:31:28 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[mcrypt]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=389</guid>
		<description><![CDATA[Adding additional functionality to the standard Apple-supplied PHP on Mac OS X 10.5 is a little tricky if you are running a 64 bit processor such as the Intel Core 2 Duo.  The reason is that any dynamic extensions that you add will need to be 64 bit, and many shared libraries by default [...]]]></description>
			<content:encoded><![CDATA[<p>Adding additional functionality to the standard Apple-supplied PHP on Mac OS X 10.5 is a little tricky if you are running a 64 bit processor such as the Intel Core 2 Duo.  The reason is that any dynamic extensions that you add will need to be 64 bit, and many shared libraries by default with compile as 32 bit binaries.  Trying to use a 32 bit extension with a 64 bit PHP results in the following unfriendly error message:</p>
<p><code>PHP Warning:  PHP Startup: Unable to load dynamic library './mcrypt.so' - (null) in Unknown on line 0</code></p>
<p><a href="http://php.net/mcrypt">mcrypt</a> is a good example of a useful extension that can be added to PHP with a little bit of effort:</p>
<ul>
<li>Open up your Terminal.app</li>
<li>To explicitly build for 64 bit architecture <code>export CFLAGS="-arch x86_64"</code></li>
<li>Download libmcrypt from sourceforge <a href="http://sourceforge.net/projects/mcrypt">http://sourceforge.net/projects/mcrypt</a></li>
<li>Unpack the archive</li>
<li><code>cd libmcrypt</code></li>
<li><code>./configure --disable-shared</code></li>
<li><code>make</code></li>
<li><code>sudo make install</code></li>
<li>download PHP 5.2.6 source from <a href=" http://www.php.net/get/php-5.2.6.tar.bz2/from/a/mirror">http://www.php.net/get/php-5.2.6.tar.bz2/from/a/mirror</a></li>
<li>unpack the archive and go into the <code>php-5.2.6/ext/mcrypt/</code> dir</li>
<li><code>phpize</code></li>
<li><code>./configure</code></li>
<li><code>make</code></li>
<li><code>sudo make install</code></li>
<li>verify the extension is 64 bit: <code>file /usr/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so</code></li>
</ul>
<p><code>/usr/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so: Mach-O 64-bit bundle x86_64</code></p>
<p>To actually use the extension, you can simply create a symbolic link to it.  For example:</p>
<ul>
<li><code>cd ~/Sites</code></li>
<li><code>ln -s  /usr/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so</code></li>
</ul>
<h3>Example code:  mcrypt.php</h3>
<p>Drop the following code into your <code>~/Sites</code> directory to verify everything is working:</p>
<pre name="code" class="php">
    &lt;?php

    if ( ! extension_loaded('mcrypt') ) {
        dl('mcrypt.so');
    }

    $key   = "this is a secret key";
    $input = "Let us meet at 9 o'clock at the secret place.";

    $td = mcrypt_module_open('tripledes', '', 'ecb', '');
    $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
    mcrypt_generic_init($td, $key, $iv);
    $encrypted_data = mcrypt_generic($td, $input);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);

    print_r($encrypted_data);

    ?&gt;
</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2009%2F03%2F16%2Fmcrypt-support-for-php-on-64-bit-mac-os-x-105%2F&amp;linkname=mcrypt%20support%20for%20PHP%20on%2064%20bit%20Mac%20OS%20X%2010.5"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2009/03/16/mcrypt-support-for-php-on-64-bit-mac-os-x-105/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>PHP Best Practices #2: Strictures</title>
		<link>http://www.glenscott.co.uk/2009/02/23/php-best-practices-2-strictures/</link>
		<comments>http://www.glenscott.co.uk/2009/02/23/php-best-practices-2-strictures/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 19:26:06 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[bestpractices]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=344</guid>
		<description><![CDATA[Make sure PHP is reporting all errors and warnings.
Warnings and notices are PHP&#8217;s way of letting you know that you are utilising features in a non-standard way.  If your code is omitting errors, then it should be fixed as soon as possible.  Strict warnings are a class of errors that are turned off [...]]]></description>
			<content:encoded><![CDATA[<h3>Make sure PHP is reporting all errors and warnings.</h3>
<p>Warnings and notices are PHP&#8217;s way of letting you know that you are utilising features in a non-standard way.  If your code is omitting errors, then it should be fixed as soon as possible.  Strict warnings are a class of errors that are turned off by default in most PHP installations.  Turning on strict warnings gives you another level of error reporting, which is helpful to prevent you from using misusing functions, making sure your code is compatible with future PHP versions.  </p>
<p>In the example here, using <code>date()</code> without explicitly setting a timezone will result in an <code>E_STRICT</code> warning.  In this case, we are using a function called <code>strictErrors</code> to tell PHP to report all error types.</p>
<h3>Example</h3>
<pre name="code" class="php">
    &lt;?php

    function strictErrors() {
        $reporting_level = E_ALL;

        // if version of PHP < 6, explicity report E_STRICT
        if ( version_compare( PHP_VERSION, '6.0.0', '<' ) ) {
            $reporting_level = E_ALL | E_STRICT;
        }

        return error_reporting( $reporting_level );
    }

    // turn on strict error and warnings
    strictErrors();

    // produces strict warning
    echo date( "d-M-Y" );

    // no warning
    date_default_timezone_set( 'Europe/London' );
    echo date( "d-M-Y" );

    ?&gt;
</pre>
<h3>Further information</h3>
<ul>
<li><a href="http://php.net/error_reporting">PHP: error_reporting</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2009%2F02%2F23%2Fphp-best-practices-2-strictures%2F&amp;linkname=PHP%20Best%20Practices%20%232%3A%20Strictures"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2009/02/23/php-best-practices-2-strictures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Best Practices #1: Regular expressions</title>
		<link>http://www.glenscott.co.uk/2009/02/19/php-best-practices-1-regular-expressions/</link>
		<comments>http://www.glenscott.co.uk/2009/02/19/php-best-practices-1-regular-expressions/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 18:00:03 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[phpbestpractices]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=332</guid>
		<description><![CDATA[preg not ereg
This is the first in what I hope will be a regular series of posts on PHP best practices, inspired in part by Damian Conway&#8217;s Perl Best Practices book.
Historically, PHP has had two incompatible regular expression engines available, POSIX Extended and PCRE (Perl Compatible Regular Expressions).  Arguably, Perl-compatible regular expressions are more [...]]]></description>
			<content:encoded><![CDATA[<h3>preg not ereg</h3>
<p>This is the first in what I hope will be a regular series of posts on PHP best practices, inspired in part by Damian Conway&#8217;s <a href="http://www.amazon.co.uk/Perl-Best-Practices-Damian-Conway/dp/0596001738">Perl Best Practices</a> book.</p>
<p>Historically, PHP has had two incompatible regular expression engines available, POSIX Extended and <a href="http://www.pcre.org/">PCRE</a> (Perl Compatible Regular Expressions).  Arguably, Perl-compatible regular expressions are more powerful since they support non-greedy matching, assertions, conditional subpatterns and a number of other features not supported by POSIX Extended.  More importantly, the POSIX Extended extension is deprecated as of PHP 5.3, meaning that a call to any of its functions, such as `ereg`, will emit a `E_DEPRECATED` notice.  Therefore, for any regular expression functionality in your scripts, use the PCRE set of functions which are prefixed with `preg_`.</p>
<h3>Example</h3>
<pre name="code" class="php">
    $pattern = '/Hello/x';
    $subject = 'Wake up and say Hello.';
    $matches = array();

    if ( preg_match( $pattern, $subject, $matches ) ) {
        print_r( $matches );
    }
</pre>
<p>Output:</p>
<pre>
    Array ( [0] => Hello )
</pre>
<h3>Further information</h3>
<ul>
<li><a href="http://php.net/pcre">PHP: PCRE &#8211; Manual</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2009%2F02%2F19%2Fphp-best-practices-1-regular-expressions%2F&amp;linkname=PHP%20Best%20Practices%20%231%3A%20Regular%20expressions"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2009/02/19/php-best-practices-1-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhpDocumentor in 5 minutes</title>
		<link>http://www.glenscott.co.uk/2009/02/18/phpdocumentor-in-5-minutes/</link>
		<comments>http://www.glenscott.co.uk/2009/02/18/phpdocumentor-in-5-minutes/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 21:21:07 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=310</guid>
		<description><![CDATA[Introduction
This is a quick and dirty guide to the absolute minimum you need to get up and running with PhpDocumentor.  
One of the slightly off-putting aspects of PhpDocumentor is the amount of tags (`@`) that are available, which can initially be overwhelming.  e.g. see PEAR example:
PEAR sample file
This guide shows you the most [...]]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>This is a quick and dirty guide to the absolute minimum you need to get up and running with <a href="http://pear.php.net/package/PhpDocumentor">PhpDocumentor</a>.  </p>
<p>One of the slightly off-putting aspects of PhpDocumentor is the amount of tags (`@`) that are available, which can initially be overwhelming.  e.g. see PEAR example:</p>
<p><a href="http://pear.php.net/manual/en/standards.sample.php">PEAR sample file</a></p>
<p>This guide shows you the most important tags that you need to have in your documentation by means of an actual example:  `Accumulator.php`.</p>
<h3>Assumptions</h3>
<ul>
<li>You are on a UNIX based machine, which includes Linux and Mac OS X.</li>
<li>You are documenting object oriented rather than procedural code</li>
</ul>
<h3>Install</h3>
<p>PhpDocumentor is part of <a href="http://pear.php.net/">PEAR</a>.  Install is easy:</p>
<pre>
    sudo pear install phpdocumentor
</pre>
<h3>Documenting your source code</h3>
<p>The rules:</p>
<ul>
<li>One class per file</li>
<li>One docbook block for the class, not for the file</li>
<li>Filename is `<class name>.php`</li>
</ul>
<p>For the class:  </p>
<ul>
<li>short description</li>
<li>code example</li>
<li>`@author`</li>
</ul>
<p>For each attribute:</p>
<ul>
<li>short description</li>
<li>`@var`</li>
</ul>
<p>For each method:</p>
<ul>
<li>short description</li>
<li>`@param`</li>
<li>`@return`</li>
<li>`@see`</li>
</ul>
<h3>Example class with documentation</h3>
<p>Accumulator.php</p>
<pre name="code" class="php">
    &lt;?php

    /**
     * An instance of this class represents a counting machine
     *
     * <code>
     * require_once 'Accumulator.php';
     *
     * $acc = new Accumulator( 10 );
     *
     * $acc->addNum( 20 );
     *
     * echo $acc->getTotal();
     * </code>
     *
     * @author Glen Scott <glen_scott@yahoo.co.uk>
     */
    class Accumulator {
        /**
         * The running total
         *
         * @var int
         */
        private $_number;

        /**
         * Create an instance, optionally setting a starting point
         *
         * @param int $initial an integer that represents the number
         *                     to start counting from
         * @access public
         */
        public function __construct( $initial = 0 ) {
            $this->_number = $initial;
        }

        /**
         * Adds a number to the running total
         *
         * @param int an integer to add to the running total
         */
        public function addNum( $num ) {
            $this->_number += $num;
        }

        /**
         * Returns the current total
         *
         * @return int returns the current running total
         * @see Accumulator::$number
         */
        public function getTotal() {
            return $this->_number;
        }
    }
</pre>
<h3>Creating your documentation</h3>
<p>    phpdoc &#8211;filename Accumulator.php &#8211;target docs</p>
<p>The `&#8221;docs&#8221;` directory is created and some HTML files are generated.  Load `docs/index.html` into your browser to read your documentation.</p>
<p><img src="/images/phpdoc_m.png" alt="PhpDoc sample page"></p>
<h3>Possible issues</h3>
<p>`&#8221;phpdoc: command not found&#8221;`.  This means that the documentation generator script is not in your path.  Run `&#8221;pear config-get bin_dir&#8221;` and add this directory to your shell&#8217;s `$PATH` environment variable.</p>
<h3>Links</h3>
<ul>
<li><a href="http://pear.php.net/package/PhpDocumentor">PhpDocumentor</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2009%2F02%2F18%2Fphpdocumentor-in-5-minutes%2F&amp;linkname=PhpDocumentor%20in%205%20minutes"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2009/02/18/phpdocumentor-in-5-minutes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Closures in PHP 5.3</title>
		<link>http://www.glenscott.co.uk/2008/12/12/closures-in-php-53/</link>
		<comments>http://www.glenscott.co.uk/2008/12/12/closures-in-php-53/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 12:16:23 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[closures]]></category>
		<category><![CDATA[functionalprogramming]]></category>
		<category><![CDATA[lambda]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=270</guid>
		<description><![CDATA[A good article from IBM&#8217;s developerWorks on the new functional programming features in the upcoming release of PHP 5.3:
What&#8217;s new in PHP V5.3, Part 2: Closures and lambda functions
]]></description>
			<content:encoded><![CDATA[<p>A good article from IBM&#8217;s developerWorks on the new functional programming features in the upcoming release of PHP 5.3:</p>
<p><a href="http://www.ibm.com/developerworks/opensource/library/os-php-5.3new2/index.html?ca=drs-tp5008">What&#8217;s new in PHP V5.3, Part 2: Closures and lambda functions</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2008%2F12%2F12%2Fclosures-in-php-53%2F&amp;linkname=Closures%20in%20PHP%205.3"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2008/12/12/closures-in-php-53/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Closing PHP tag considered harmful</title>
		<link>http://www.glenscott.co.uk/2008/11/12/closing-php-tag-considered-harmful/</link>
		<comments>http://www.glenscott.co.uk/2008/11/12/closing-php-tag-considered-harmful/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 13:28:31 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[space]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=232</guid>
		<description><![CDATA[A good tip from Zend, who recommend omitting the closing PHP tag (?>) when your files contain pure PHP code.  This can prevent additional whitespace being inserted into the script output.  Extra whitespace can cause problems, for example, if you are trying to set your own custom HTTP headers:  nothing should be [...]]]></description>
			<content:encoded><![CDATA[<p>A good tip from <a href="http://www.zend.com/">Zend</a>, who recommend omitting the closing PHP tag (<code>?></code>) when your files contain pure PHP code.  This can prevent additional whitespace being inserted into the script output.  Extra whitespace can cause problems, for example, if you are trying to set your own custom HTTP headers:  nothing should be output before the call to the <code><a href="http://php.net/header">header</a></code> function.  Otherwise, this classic error will occur:</p>
<p><code><br />
Cannot modify header information - headers already sent by (output started at myinclude.php:16) in myscript.php on line 15<br />
</code> </p>
<p><a href="http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html#coding-standard.php-file-formatting.general">Zend Framework: Documentation</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2008%2F11%2F12%2Fclosing-php-tag-considered-harmful%2F&amp;linkname=Closing%20PHP%20tag%20considered%20harmful"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2008/11/12/closing-php-tag-considered-harmful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your top places, according to Flickr</title>
		<link>http://www.glenscott.co.uk/2008/09/12/your-top-places-according-to-flickr/</link>
		<comments>http://www.glenscott.co.uk/2008/09/12/your-top-places-according-to-flickr/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 16:55:53 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[flickr]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[place]]></category>

		<guid isPermaLink="false">http://www.glenscott.co.uk/?p=149</guid>
		<description><![CDATA[I&#8217;ve been messing around with a little Flickr application this afternoon which shows your top places.  Here are mine:

Give it a try and post a comment with your number one place:
Flickr Top Places
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been messing around with a little Flickr application this afternoon which shows your top places.  Here are mine:</p>
<p><img src="/images/glen-scott-top-places.png" style="margin: 10px" /></p>
<p>Give it a try and post a comment with your number one place:</p>
<p><a href="/apps/flickr-top-places/">Flickr Top Places</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.glenscott.co.uk%2F2008%2F09%2F12%2Fyour-top-places-according-to-flickr%2F&amp;linkname=Your%20top%20places%2C%20according%20to%20Flickr"><img src="http://www.glenscott.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.glenscott.co.uk/2008/09/12/your-top-places-according-to-flickr/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
