phpDocumentor scans PHP code and DocBlock comments to emit API reference documentation. It can also render class diagrams and parse Markdown or reStructuredText guides.
Overview
phpDocumentor analyzes PHP projects and produces structured API documentation from source and inline DocBlock annotations. Output can include browsable reference pages, and optional class diagrams depend on PlantUML when that tool is installed on the host running the generator.
The tool supports modern PHP language features such as namespaces, closures, and generic type annotations reflected in the docs. It parses an incremental structure cache first, which speeds repeat runs when the cache file is kept. Templates are customizable for branding, and markup in reStructuredText or Markdown can embed live API excerpts.
Installation paths include phive, a PHAR file, Docker image phpdoc/phpdoc, and a Composer shim the authors discourage for dependency conflict reasons. Running phpdoc with -d and -t points input sources and an output directory, and phpdoc.xml configuration files tune behavior without long command lines.
Generated sites may offer full-text search offline, and CI examples use a GitHub Action or the Docker image to regenerate docs in pipelines. Class diagram generation is gated behind --setting=graphs.enabled=true when PlantUML is available.
Key features
- API docs from PHP source and DocBlocks
- UML class diagrams via PlantUML
- reStructuredText and Markdown parsing
- Incremental parsing with structure cache
- Customizable documentation templates
- Generics and advanced PHP type display
- Docker PHAR phive installation options
- Configuration files phpdoc.xml
Use cases
- Publishing PHP library API reference sites
- Keeping internal package docs in CI
- Visualizing class structure with diagrams
- Linking prose guides to live API snippets