PhpDocumentor

Contents


Starting in Version 7.0, NetBeans IDE supports the PhpDocumentor documentation infrastructure.

PHP 5.3 and PhpDocumentor

Namespaces and closures are not supported by PhpDocumentor. Attempting to run PhpDocumentor on files containing 5.3 namespaces or closures will result in PhpDocumentor crashing. It is possible to run PhpDocumentor on PHP 5.3 applications without these features, though this may not be very useful.

If you need to document a PHP 5.3 project, please consider one of the other documenting tools listed in PHP Documentation Support in NetBeans IDE

Video on PhpDocumentor in NetBeans IDE

A screencast of installing, configuring, and using PhpDocumentor in NetBeans IDE is available at http://netbeans.org/kb/docs/php/screencast-phpdoc.html.

Installing the PhpDocumentor support plugin

Installing the plugin is easy. In the IDE, go to Tools > Plugins and install the PhpDocumentor Tag Help plugin. However, you also need to install and configure PhpDocumentor itself.

Installing PhpDocumentor

You can install PhpDocumentor in two ways:

  • Download and extract one of the archives through pear.php.net and sourceforge.net.
  • Use the PEAR installer.

Instructions for installing PhpDocumentor are available on the phpDocumentor website.

Configuring Path to phpDocumentor.ini

After installing PhpDocumentor, you may need to edit the phpDocumentor run script, especially on Windows. The phpdoc run script includes a path to the phpDocumentor.ini file. However, the path may not be correct. By default, the installer assumes that phpDocumentor.ini is in a subfolder of the same folder as the run script. For example, a phpdoc.bat file in Windows Vista uses the path .\pear\data\PhpDocumentor\ to phpDocumentor.ini:

ECHO # 0: phpDocumentor.ini
SET count=0
FOR /R ".\pear\data\PhpDocumentor\user" %%I IN (*.ini) DO ( ...

On this machine, phpdoc.bat is in C:/xampp/php. However, phpDocumentor.ini is in C:/Users/username/pear/data/PhpDocumentor/. Therefore phpdoc.bat must be modified to contain the path from C:/Users/username, otherwise PhpDocumentor will not work. Do not edit the path itself. Instead, at the top of phpdoc.bat, change the directory so that the path is correct.

 SET phpCli=G:\xampp\php\php.exe
 C:
 cd C:\Users\username

The general procedure for setting the path to phpDocumentor.ini follows:

  1. Use system tools to locate phpDocumentor.ini and the phpdoc run script.
  2. Open the phpdoc run script in an editor. See if the path to phpDocumentor.ini is correct.
  3. If necessary, add a change directory command to the beginning of the run script.

Setting Up NetBeans IDE To Use phpDocumentor

After you install the phpDocumentor support plugin and install and configure phpDocumentor, set up the NetBeans options to use PhpDocumentor. To set up NetBeans:

  1. In the IDE, go to Tools > Options (NetBeans > Preferences on Mac)
  2. Click the PHP icon. The PHP options open.
  3. Open the PhpDoc tab.
  4. Select the phpdoc run script. You can either click Browse and browse your file system, or click Search and let NetBeans search for all possible phpdoc scripts.
  5. Add any optional command line switches you want. A list of command-line options is available on the PhpDocumentor website.

Generating Documentation

To generate phpDocumentation, right-click a project node and select Generate PhpDoc

Generating Documentation the First Time

The first time you generate documentation for a project, you are asked for a target directory to contain the documentation. You can create a new directory to contain the documentation.

Important: The path to the target directory must contain forward slashes only.

Changing Target Directory

You can change the directory in which documentation is generated. Change this directory in the project's Properties.

  1. Right-click the project node and select Properties. The Properties dialog opens.
  2. Select PhpDoc.
  3. Change the directory. Important: The path to the target directory must contain forward slashes only.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo