Fork me on GitHub

PHPDoctor - The PHP API Documentation Creator

Frequently Asked Questions

Q: Why do we need another Javadoc clone for PHP?
A: I wrote PHPDoctor because I couldn't find a Javadoc clone for PHP that was small and simple and worked out of the box without having to spend hours reading documentation and tweaking my PHP code. The PHP tokenizer extension has made creating PHPDoc programs really easy since PHP can now do the hard work for you.
Q: Why is PHPDoctor different from other PHPdoc programs?
A: PHPDoctor is very small and easy to use, even the templating layer it uses for output generation is small and simple to understand. PHPDoctor has a very small learning curve, most people should be able to generate API documentation in only a few minutes.
Q: Tell me more about how PHPDoctor works
A: PHPDoctor uses the PHP tokenizer extension, this means that it lets PHP do the parsing of your source code. PHPDoctor just takes the tokens PHP parses out, turns them into an object hierarchy and finally into your API documentation. This means it will work for any PHP code, no exceptions, it also makes it very fast. The down side of this is that it needs PHP 4.3 or above to work.

Installation and Usage

Unzip the archive somewhere, copy and edit the default config file and then run phpdoc.php with your CLI version of PHP (the CGI version may also work from the commandline):

php phpdoc.php myconfig.ini

To get PHPDoctor to work, you first need to write a configuration file for the code you want to parse. Copy and edit the default config file, it is commented and pretty straight forward to understand.

Configuration Directives

PHPDoctor supports a number of configuration directives:

Names of files to parse. This can be a single filename, or a comma separated list of filenames. Wildcards are allowed.
Names of files or directories to ignore. This can be a single filename, or a comma separated list of filenames. Wildcards are NOT allowed.
The directory to look for files in, if not used the PHPDoctor will look in the current directory (the directory it is run from).
If you do not want PHPDoctor to look in each sub directory for files uncomment this line.
Set how loud PHPDoctor is as it runs. Quiet mode suppresses all output other than warnings and errors.
Set how loud PHPDoctor is as it runs. Verbose mode outputs additional messages during execution.
Select the doclet to use for generating output.
The directory to find the doclet in. Doclets are expected to be in a directory named after themselves at the location given.
The directory to find taglets in. Taglets allow you to make PHPDoctor handle new tags and to alter the behavour of existing tags and their output.
If the code you are parsing does not use package tags or not all elements have package tags, use this setting to place unbound elements into a particular package.
Specifies the name of a HTML file containing text for the overview documentation to be placed on the overview page. The path is relative to "source_path" unless an absolute path is given.
Package comments will be looked for in a file named package.html in the same directory as the first source file parsed in that package or in the directory given below. If package comments are placed in the directory given below then they should be named ".html".
Parse out global variables.
Parse out global constants.
Generate documentation for all class members
Generate documentation for public and protected class members
Generate documentation for only public class members
The directory to place generated documentation in. If the given path is relative to it will be relative to "source_path".
Specifies the title to be placed in the HTML
Specifies the title to be placed near the top of the overview summary file.
Specifies the header text to be placed at the top of each output file. The header will be placed to the right of the upper navigation bar.
Specifies the footer text to be placed at the bottom of each output file. The footer will be placed to the right of the lower navigation bar.
Specifies the text to be placed at the bottom of each output file. The text will be placed at the bottom of the page, below the lower navigation bar.
Create a class tree

Doc Comments

A full description of the format of doc comments can be found on the Sun Javadoc web site. Doc comments look like this:

 * This is the typical format of a simple documentation comment
 * that spans two lines.

Note the extra asterisk after the opening comment line.

PHPDoctor supports most of the Javadoc tags defined by Sun. The following tags are supported:

Some Javadoc tags are not relevant to PHP and so are ignored, others are added or slightly changed due to PHPs loose typing:


If you find PHPDoctor useful, have found a bug, or want to request a feature, please get in touch either through our Github issue tracker.

The only way to make PHPDoctor a better product is to test it against more and more PHP code. We think PHPDoctor is pretty good at doing its job, it works against all the libraries we've tried it on, but then again you might write something wierd that causes it to barf, so let us know how it faired against your code.

Access to Git

If your hunting bugs, grab the latest version from Github or directly via Git:

git clone git://

Copyright and License

The information below applies to everything in the distribution, except where noted.

Copyright 2004 by Paul James.
paul at

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public License along
with this program (COPYING); if not, go to or write
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.