phpDocumentor analyzes your code
to create great documentation

phpDocumentor enables you to generate documentation from your PHP source code. This documentation provides an in-depth view of your project to you, your consumers and contributors.

Demo Learn more

What is phpDocumentor?


phpDocumentor 2 is a tool that makes it possible to generate documentation directly from your PHP source code. With this you can provide your consumers with more information regarding the functionality embedded within your source and not just what is usable to them from your user interface.

Documentation generated by phpDocumentor 2 does not aim to be a replacement for conventional documentation but is rather supplemental, or reference, documentation.This proves to be useful in the following example situations:

  • Sets of libraries or applications providing an API, such as phpDocumentor 2 itself
  • Frameworks, such as Zend Framework or Symfony
  • Pluggable architectures, such as WordPress or PyroCMS
  • Long-running, complex projects, to help you find the right function or method for the job



phpDocumentor 2 contains an incredibly flexible template system which enables you to alter your output in any way imaginable. This can range from simply applying your own branding for the HTML output by merely altering a couple of CSS files to determining which types of output are generated and where they are made available.

Code Analysis

Code Analysis

phpDocumentor 2 is capable of extracting interesting information and presenting it in the form of graphs and reports. The following are currently supported:

  • An inheritance diagram showing all subclassing and implementing of interfaces.
  • Reporting errors in your source code's inline documentation.
  • Reporting which elements are marked as deprecated.
  • Reporting where TODOs are placed in your code and what is to be done.

This list will only grow in the future to help you determine where to invest your resources in order to make your code more stable and maintainable.

How does it work?


Writing the first DocBlocks

Generating the documentation


With PEAR installed, please run the following commands:

pear channel-discover
pear install phpdoc/phpDocumentor

Once the installation is complete a global command, called phpdoc, will be available.

Add a dependency to phpdocumentor/phpdocumentor to the require-dev section of your project's composer.json configuration file, and update your application.

The following code is an example of a minimal composer.json file:

    "require-dev": {
        "phpdocumentor/phpdocumentor": "2.*"

Once the installation is complete there will be a command phpdoc.php in the binary folder of your application (/vendor/bin by default).

Hint: phpDocumentor consumes a fair amount of dependencies, if this is inconvenient then we suggest you choose one of the other installation options.

To do a manual installation, follow these steps

  1. Locate the latest release on the releases page for phpDocumentor2 on GitHub
  2. Download the attached tarball (not the source code!)
  3. Extract the downloaded tarball into your destination directory.

After you have done the above can the executable be found at bin/phpdoc.php in the installation directory.