Working with PHPDocumentor

Prerequisites

How do I install plugins in Zend Studio?

Generating a PHPDoc

This procedure describes how to create a PHPDoc from your PHP files.

 

 

Instructions on how to complete a procedure

To generate a PHPDoc:

  1. In the menu-bar, go to Project | Generate PHPDoc.
    The Generate PHPDoc wizard is displayed.

  1. Select the resources for which the PHPDoc is to be generated for.
  2. Select the destination for the PHPDoc, the PHPDocumentor phar file, and the PHP Executable .

    Note:

    If the destination folder is not empty, an error message will be displayed at the top of the wizard. Change the directory path, or click Delete contents to empty the folder.

  3. Click Next.

  1. Configure the following settings:
    • Profile - Click the drop-down menu, and select a profile for your PHPDoc. To edit your profiles, click the Go to profile preferences page link on the right. For more information on configuring PHPDocumentor profiles, see Configuring PHPDoc Profiles below.
    • Doc title - Enter a title for the generated PHPDoc (default: Example title).
    • Default package - Enter a name for the default package (default: Example default package name).
    • Markers - Enter a list of markers to be included in the generated PHPDoc (default: TODO, FIXME).
    • Extensions - Enter a list of file extensions to be included in the generated PHPDoc (default: php, phtml).
    • Ignore patterns - Enter a list of file patterns to be excluded (e.g., tests/*).
    • Template - Select a template for the generated PHPDoc. Use the window below to preview each template.
    • Logging level - Select the minimum level of information to be logged.
  2. Select the Open generated documentation in browser check-box to view your PHPDoc once created.
  3. Click Finish.
    The PHPDoc is created and opened in your browser.

Tip:

You can also generate a PHPDoc for a specific project by right-clicking your project in the PHP Explorer, and selecting Generate project PHPDoc. If you have a project specific profile, it will automatically be selected. For more information on configuring PHPDocumentor profiles, see Configuring PHPDoc Profiles below.

Configuring PHPDoc Profiles

This procedure describes how to create and use different PHPDoc profiles.

Instructions on how to complete a procedure

To configure your PHPDoc profiles:

  1. In the menu-bar, go to Window | Preferences | PHP | PHPDocumentor Profile.
    The PHPDocumentor Profile preferences page is displayed.

  1. To configure an existing profile, click the Profile drop-down menu, and select the profile you wish to edit (skip to step 5). To create a new profile, click New.
    The New PHPDocumentor Profile dialog is displayed.

  1. Name your new profile, and select the profile you want to initialize it from.
  2. Click OK.
  3. Configure your profile:
  • Doc title - Enter a title for the generated PHPDoc (default: Example title).
  • Default package - Enter a name for the default package (default: Example default package name).
  • Markers - Enter a list of markers to be included in the generated PHPDoc (default: TODO, FIXME).
  • Extensions - Enter a list of file extensions to be included in the generated PHPDoc (default: php, phtml).
  • Ignore patterns - Enter a list of file patterns to be excluded (e.g., tests/*).
  • Template - Select a template for the generated PHPDoc. Use the adjacent window to preview each template.
  • Logging level - Select the minimum level of information to be logged.
  1. Click Apply to save your profile, and OK to exit the Preferences dialog.

Tip:

To configure a project specific profile, click Configure Project Specific Settings in the top-right corner of the preferences page. This sets the default profile to be used when generating a PHPDoc for a specific project.

Adding PHP DocBlock Comments

This procedure describes how to add PHPDoc Comments to PHP elements.

To create a PHPDoc Comment:

In the line above the code for the PHP element, enter the DocBlock characters /**, and press Enter.
-OR-

Right-click the relevant element in the Outline View, and select Source | Generate Element Comment.

A PHPDoc Comment will be created with several parameters to be edited with the relevant information.

The default code comments generated for different elements can be configured through the Code Templates Preferences page.