Thursday, January 28, 2010
Thursday, January 21, 2010
Documenting PHP Extension
I've been trying to use phpdoc with a PHP Extension I'm writing for work and it isn't obvious. Thankfully I found this post about Kristen Chodorow's phpdoc pain
It turns out you have to get phpdoc from svn and use that.
To checkout the doc tree (had to upgrade from the stock svn on OS X leopard first - thanks homebrew!)
And install phd (I had to install sqlite3 first - yes I'm using ports for that)
Create an XML template
Now you have to merge that into the main php docs
Edit phpdoc/manual.xml.in and add a reference for your extension (I added mine under database vendors)
In phpdoc/en/reference add a file called entities.myext.xml - I'm still tinkering with what needs to go in there, base it on one of the other files in the same directory.
Finally, run phd
It creates files in a directory named output. Now all I need to do is work out what to put where to get decent output.
It turns out you have to get phpdoc from svn and use that.
To checkout the doc tree (had to upgrade from the stock svn on OS X leopard first - thanks homebrew!)
svn co http://svn.php.net/repository --depth empty phpdoc
svn co http://svn.php.net/repository/phpdoc/en/trunk --depth infinity phpdoc/en
svn co http://svn.php.net/repository/phpdoc/doc-base/trunk --depth infinity phpdoc/doc-base
And install phd (I had to install sqlite3 first - yes I'm using ports for that)
sudo port install php5-sqlite +debug
sudo pear install doc.php.net/phd-beta
Create an XML template
/path/to/svn/phpdoc/php -d debug_mode=1 -d extension_dir=modules/ -d extension=myext.so /Users/jmeredith/src/php/phpdoc/doc-base/scripts/docgen/docgen.php --output tmp --extension myext
Now you have to merge that into the main php docs
cp -rp tmp /Users/jmeredith/src/php/phpdoc/en/reference/myext
Edit phpdoc/manual.xml.in and add a reference for your extension (I added mine under database vendors)
&reference.magneto.book;
In phpdoc/en/reference add a file called entities.myext.xml - I'm still tinkering with what needs to go in there, base it on one of the other files in the same directory.
Finally, run phd
phd -d /Users/jmeredith/src/php/phpdoc/doc-base/.manual.book.myext.xml
It creates files in a directory named output. Now all I need to do is work out what to put where to get decent output.
Subscribe to:
Posts (Atom)