PHP Classes


Recommend this page to a friend!
  Classes of Francesco Danti  >  Sphinx PHP Doc RST  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Sphinx PHP Doc RST
Generate Sphinx documentation from PHPDoc comments
Author: By
Last change:
Date: 2 years ago
Size: 3,705 bytes


Class file image Download


Build Status Coverage Status Codacy Badge

Scrutinizer Code Quality Code Coverage Build Status

Forked and refactor by Francesco "Abbadon1334" Danti.

Now working as intended, with good coverage.

Generate reStructuredText for Sphinx based documentation from PHPDoc annotations.

This project is heavily based on phpDocumentor/Reflection and makes use of sphinxcontrib-phpdomain.

An example for the documentation output can be found in our own documentation


Install phpdoc-to-rst to your project directory:

composer require --dev abbadon1334/phpdoc-to-rst

Command line usage

Run the command line tool to parse the folders containing your PHP tree and render the reStructuredText files to the output directory:

php vendor/bin/phpdoc-to-rst generate --repo-base "$PWD" --repo-github -t docs/rst/ src/

Programatically usage to generate documentation rst

    // your source path or multiple path to be parsed
    $src = [__DIR__.'/../src'];
    // destination path for the documentation
    $dst = __DIR__.'/../docs/api';
    $apiDocBuilder = new ApiDocBuilder($src, $dst);
    // DEBUG FATURES : optional
    // optional : activate verbosity
    // optional : activate debug
    // EXTENSIONS : optional
     * Do not render classes marked with phpDoc internal tag
     * Do only render public methods/properties.
     * Do not render classes marked with phpDoc internal tag
     * Do only render public methods/properties.
     * This extension will render a list of methods  for easy access
     * at the beginning of classes, interfaces and traits.
     * This extension adds a link to the source at github to all elements.
     * Arguments
     * 0 => Url to the github repo (required)
     * 1 => Path to the git repository (required)
     * 2 => Branch to link to (default=master)
    $apiDocBuilder->addExtension(GithubLocationExtension::class, [
    // Build documentation

For more information send a message to info at phpclasses dot org.