Doxygen is a source file documentor, compatible with PHP documentation in phpdoc format. Unlike phpdoc (aka PhpDocumentor) it doesn’t require a ridiculous amount memory on a large code base).
- Generate config file with
doxygen -g doxygen.conf
- Run with ‘doxygen doxygen.conf’
It will generate a directory called ‘html’.
GUI
You can generate the docs with the GUI frontend.
E.g. If you have your source in htdocs
, set the source code directory to htdocs
and scan recursively. Set the destination directory to something sensible like htdocs/doc
.
Generate via Run -> Run doxygen.
View htdocs/doc/html/index.html.
PHP
If you’re developing for PHP, in Wizard -> Mode set to ‘optimize for C or PHP output’. In Output, untick LaTeX as you probably only need HTML.
Drupal
If you’re developing for Drupal, you’ll need to either add some configuration.
Via the GUI:
- Add
.install
,.module
and.inc
to the list of extensions at Expert -> Input -> FILE_PATTERNS. - Add
install=PHP
,module=PHP
andinc=PHP
to Expert -> Project -> EXTENSION_MAPPING.
Or add the following to the doxygen config file:
FILE_PATTERNS = *.php *.module *.install *.inc
EXTENSION_MAPPING = module=PHP install=PHP inc=PHP
Reference: How do I configure doxygen to recognise *.module is PHP?
As mentioned above, if you have your source in htdocs
, set the source code directory to htdocs
and scan recursively. Set the destination directory to something like htdocs/doc
. Generate via Run -> Run doxygen.
View htdocs/doc/html/index.html. The easiest way to navigate to the documentation for a module is via the Files tab.
No documentation?
If you’re not seeing any documentation, you’ll need to add the following to your code:
/**
* @file
*
* Some documentation for the file.
*/