<?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>Robertdot, A Web Design Blog &#187; Documentation</title>
	<atom:link href="http://robertdot.org/tags/documentation/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertdot.org</link>
	<description>A web design blog for designers that develop or developers that design.</description>
	<lastBuildDate>Fri, 05 Mar 2010 15:59:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Documentation Generators</title>
		<link>http://robertdot.org/2007/02/15/php-documentation-generators/</link>
		<comments>http://robertdot.org/2007/02/15/php-documentation-generators/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 10:31:41 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://robertdot.org/2007/02/15/php-documentation-generators/</guid>
		<description><![CDATA[
 I&#8217;ve been looking at documentation generators recently.  Specifically, I&#8217;m playing with a new website that I want to do Right.  Here are some notes for anyone looking at PHP documentation generators.

Languages

 I needed a documentation generator primarily for PHP.  However, I thought it&#8217;d be nice if it&#8217;d create documentation for JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p>
 I&#8217;ve been looking at documentation generators recently.  Specifically, I&#8217;m playing with a new website that I want to do Right.  Here are some notes for anyone looking at PHP documentation generators.
</p>
<h2>Languages</h2>
<p>
 I needed a documentation generator primarily for <abbr title="PHP Hypertext Preprocessor">PHP</abbr>.  However, I thought it&#8217;d be nice if it&#8217;d create documentation for JavaScript as well.
</p>
<h2>Possible Options</h2>
<ol>
<li>
<h3>PHPDocumentor</h3>
<p>
   Formerly called PHPDoc, <a href="http://phpdoc.org/">PHPDocumentor</a> was my first choice because I&#8217;ve heard of it before.  It&#8217;s based on JavaDoc, and is conveniently packaged in <abbr title="PHP Extension and Application Repository">PEAR</abbr>.  The syntax is a little weird at first, and documenting blocks of code inline doesn&#8217;t seem to be possible.  However, it figures out a lot of useful stuff.  PHPDocumentor, of course, doesn&#8217;t work with JavaScript.  Despite the lacking feature, this is document generator I implemented.
  </p>
</li>
<li>
<h3>HeaderDoc</h3>
<p>
   <a href="http://developer.apple.com/opensource/tools/headerdoc.html">HeaderDoc</a> is Apple&#8217;s documentation system.  It works with both PHP and JavaScript (as well as several other languages).  I browsed the documentation, but haven&#8217;t bothered downloading the PERL code to compile it.  I skipped on it because it seems far too robust (that is, bloated) for what I need and lacked some of the niceties of PHPDocumentor (<abbr title="for example">e.g.</abbr> detecting function names).
  </p>
</li>
<li>
<h3>Natural Docs</h3>
<p>
   I was <em>really</em> excited about <a href="http://www.naturaldocs.org/">Natural Docs</a> when I first heard about it.  The syntax seemed easy and it was supposed to understand inheritance, which would be a boon for JavaScript.  Unfortunately, JavaScript and PHP are only supported insofar as they can be read in the document.  No nifty features like they have with ActionScript, PERL, and <abbr title="C Sharp">C#</abbr>.  Too bad.
  </p>
</li>
<li>
<h3>Others</h3>
<p>
   I briefly looked at a few others that supported PHP and JavaScript.  <a href="http://www.xs4all.nl/~rfsber/Robo/robodoc.html">RoboDoc</a> has <abbr title="fucking ugly">fugly</abbr> syntax and TwinText is supposedly Windows only (assuming it existed).  Neither were going to be right for me.
  </p>
</li>
</ol>
<h2>PHPDocumentor in Use</h2>
<h3>Install</h3>
<p>
 As I mentioned, PHPDocumentor is a PEAR package.  That made the install very easy.  I actually overcomplicated it quite a bit because of a few errors I had with the script.  For future reference, you want to run <kbd>pear install PHPDocumentor-beta</kbd> since PHPDoc is depreciated. One will override the other.
</p>
<p>
 As I said, when I tried to run <kbd>phpdoc</kbd>, I got an error about a file missing.  Mac OS X apparently stores files in different places than the package expects.  So, I had to edit the package and add <code>chdir("/usr/lib/php/");</code> so that <code>include("PhpDocumentor/phpDocumentor/phpdoc.inc");</code> would be run in the proper directory.
</p>
<p>
 Since I wanted to have my documentation as a sub directory of my site, I had to write a shell script to clean out my documentation folder then run the PHPDocumentor command.  Otherwise, PHPDocumentor would attempt to document the documentation.
</p>
<h3>Learning</h3>
<p>
 I was a little bewildered by the syntax at first.  This is mainly because it&#8217;s really hard to find solid examples of how to document code.  The <a href="http://manual.phpdoc.org">manual</a> provides a little bit of instruction, but lacks real world examples.  Luckily, I found a good example in the <a href="http://pear.php.net/manual/en/standards.sample.php">PEAR coding standards documentation</a>.  It wasn&#8217;t long until the syntax was second nature.
</p>
<p>
 The only real gripe I have is that I&#8217;d like to be able to make inline comments about specific blocks of code.  For example, a <code>switch</code>.  It turns out that you have to do that within the function discussion.  You can print code blocks in the discussion area, however.  So, it&#8217;s almost as though you can do inline documentation.
</p>
<p>
 I also should note that <code>@var</code> can only be attached to a class variable declaration, not any variable at all.
</p>
<h3>Output</h3>
<p>
 I struggled with the output.  I hate frames.  So, I used the Smarty layouts for output at first.  Eventually, I switched to the default frames layout because it handled some of the output better (e.g. unordered lists in discussions).  Otherwise, it makes nice legible documentation that can be read on a web browser.  It can also output <abbr title="Portable Document Format">PDF</abbr>, and Windows Help files.
</p>
<h2>Final Opinions</h2>
<p>
 PHPDocumentor is a pretty nice tool.  Not only does it create documentation, it introduces a standard for commenting that is very legible.  While I wish I cold have found a JavaScript and PHP document generator that I was happy with, PHPDocumentor does its job well.</p>
]]></content:encoded>
			<wfw:commentRss>http://robertdot.org/2007/02/15/php-documentation-generators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
