PHP Classes

Sphinx PHP Doc RST : Generate Sphinx documentation from PHPDoc comments

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 43 All time: 10,838 This week: 560Up
Version License PHP version Categories
phpdoc-to-rst 1.0.0MIT/X Consortium ...7PHP 5, Tools, Parsers
Collaborate with this project 

Author

phpdoc-to-rst - github.com

Description

This package can generate Sphinx documentation from PHPDoc comments.

It can traverse the PHP source code files and parses them to extract documentation of class functions and variables.

The package can generate output in Sphinx ReStructured Text format.

Innovation Award
PHP Programming Innovation award nominee
August 2019
Number 2
Sphinx is the name of a format and a tool to generate documentation for the Python language.

Like the Python language, it uses indentation to show the different levels of nested content in a way that makes it more readable what is the level of nesting of document blocks that are contained in the respective parent document blocks.

This package can generate documentation in Sphinx format from PHP classes that contain function and variable documentation details in comments formatted in the PHPDoc format.

Manuel Lemos
Picture of Francesco Danti
  Performance   Level  
Name: Francesco Danti <contact>
Classes: 7 packages by
Country: Italy Italy
Age: 46
All time rank: 3468136 in Italy Italy
Week rank: 195 Up9 in Italy Italy Up
Innovation award
Innovation award
Nominee: 2x

Documentation

phpdoc-to-rst

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

Quickstart

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 https://github.com/abbadon1334/phpdoc-to-rst -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
    $apiDocBuilder->setVerboseOutput(true);
    // optional : activate debug
    $apiDocBuilder->setDebugOutput(true);
    
    // EXTENSIONS : optional
        
    /
     * Do not render classes marked with phpDoc internal tag
     * Do only render public methods/properties.
     */
    $apiDocBuilder->addExtension(PublicOnlyExtension::class);
        
    /
     * Do not render classes marked with phpDoc internal tag
     * Do only render public methods/properties.
     */
    $apiDocBuilder->addExtension(NoPrivateExtension::class);
        
    /
     * This extension will render a list of methods  for easy access
     * at the beginning of classes, interfaces and traits.
     */
    $apiDocBuilder->addExtension(TocExtension::class);
        
    /
     * 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, [
        __DIR__.'/../src',
        'http://github.com/abbadon1334/phpdoc-to-rst/',
    ]);
    
    // Build documentation
    $apiDocBuilder->build();


  Files folder image Files (161)  
File Role Description
Files folder imagebin (1 file)
Files folder imagedocs (8 files, 4 directories)
Files folder imageexample (1 file)
Files folder imagesrc (3 files, 3 directories)
Accessible without login Plain text file .readthedocs.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Makefile Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file renovate.json Data Auxiliary data

  Files folder image Files (161)  /  bin  
File Role Description
  Accessible without login Plain text file phpdoc-to-rst Example Example script

  Files folder image Files (161)  /  docs  
File Role Description
Files folder imageapi (2 files, 1 directory)
Files folder image_build (1 directory)
Files folder image_static (1 file)
Files folder image_templates (1 file)
  Accessible without login Plain text file cli.rst Data Auxiliary data
  Accessible without login Plain text file conf.py Data Auxiliary data
  Accessible without login Plain text file extensions.rst Data Auxiliary data
  Accessible without login Plain text file index.rst Data Auxiliary data
  Accessible without login Plain text file make.bat Data Auxiliary data
  Accessible without login Plain text file Makefile Data Auxiliary data
  Accessible without login Plain text file requirements.txt Doc. Documentation
  Accessible without login Plain text file usage.rst Data Auxiliary data

  Files folder image Files (161)  /  docs  /  api  
File Role Description
Files folder imageJuliusHaertl (1 directory)
  Accessible without login Plain text file index-namespaces-all.rst Data Auxiliary data
  Accessible without login Plain text file index.rst Data Auxiliary data

  Files folder image Files (161)  /  docs  /  api  /  JuliusHaertl  
File Role Description
Files folder imagePHPDocToRst (4 files, 3 directories)

  Files folder image Files (161)  /  docs  /  api  /  JuliusHaertl  /  PHPDocToRst  
File Role Description
Files folder imageBuilder (10 files)
Files folder imageExtension (9 files)
Files folder imageMiddleware (2 files)
  Accessible without login Plain text file ApiDocBuilder.rst Data Auxiliary data
  Accessible without login Plain text file GenerateDocumentationCommand.rst Data Auxiliary data
  Accessible without login Plain text file index.rst Data Auxiliary data
  Accessible without login Plain text file WriteException.rst Data Auxiliary data

  Files folder image Files (161)  /  docs  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Builder  
File Role Description
  Accessible without login Plain text file ClassFileBuilder.rst Data Auxiliary data
  Accessible without login Plain text file ExtensionBuilder.rst Data Auxiliary data
  Accessible without login Plain text file FileBuilder.rst Data Auxiliary data
  Accessible without login Plain text file index.rst Data Auxiliary data
  Accessible without login Plain text file InterfaceFileBuilder.rst Data Auxiliary data
  Accessible without login Plain text file MainIndexBuilder.rst Data Auxiliary data
  Accessible without login Plain text file NamespaceIndexBuilder.rst Data Auxiliary data
  Accessible without login Plain text file PhpDomainBuilder.rst Data Auxiliary data
  Accessible without login Plain text file RstBuilder.rst Data Auxiliary data
  Accessible without login Plain text file TraitFileBuilder.rst Data Auxiliary data

  Files folder image Files (161)  /  docs  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Extension  
File Role Description
  Accessible without login Plain text file AddFullElementNameExtension.rst Data Auxiliary data
  Accessible without login Plain text file Extension.rst Data Auxiliary data
  Accessible without login Plain text file GithubLocationExtension.rst Data Auxiliary data
  Accessible without login Plain text file HideChildNamespaces.rst Data Auxiliary data
  Accessible without login Plain text file index.rst Data Auxiliary data
  Accessible without login Plain text file InterfaceImplementors.rst Data Auxiliary data
  Accessible without login Plain text file NoPrivateExtension.rst Data Auxiliary data
  Accessible without login Plain text file PublicOnlyExtension.rst Data Auxiliary data
  Accessible without login Plain text file TocExtension.rst Data Auxiliary data

  Files folder image Files (161)  /  docs  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Middleware  
File Role Description
  Accessible without login Plain text file ErrorHandlingMiddleware.rst Data Auxiliary data
  Accessible without login Plain text file index.rst Data Auxiliary data

  Files folder image Files (161)  /  docs  /  _build  
File Role Description
Files folder imagehtml (9 files, 3 directories)

  Files folder image Files (161)  /  docs  /  _build  /  html  
File Role Description
Files folder imageapi (2 files, 1 directory)
Files folder image_sources (4 files, 1 directory)
Files folder image_static (21 files, 3 directories)
  Accessible without login Plain text file .buildinfo Data Auxiliary data
  Accessible without login HTML file cli.html Doc. Documentation
  Accessible without login HTML file extensions.html Doc. Documentation
  Accessible without login HTML file genindex.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login HTML file php-modindex.html Doc. Documentation
  Accessible without login HTML file search.html Doc. Documentation
  Accessible without login Plain text file searchindex.js Data Auxiliary data
  Accessible without login HTML file usage.html Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  api  
File Role Description
Files folder imageJuliusHaertl (1 directory)
  Accessible without login HTML file index-namespaces-all.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  api  /  JuliusHaertl  
File Role Description
Files folder imagePHPDocToRst (4 files, 3 directories)

  Files folder image Files (161)  /  docs  /  _build  /  html  /  api  /  JuliusHaertl  /  PHPDocToRst  
File Role Description
Files folder imageBuilder (10 files)
Files folder imageExtension (9 files)
Files folder imageMiddleware (2 files)
  Accessible without login HTML file ApiDocBuilder.html Doc. Documentation
  Accessible without login HTML file GenerateDocumentationCommand.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login HTML file WriteException.html Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Builder  
File Role Description
  Accessible without login HTML file ClassFileBuilder.html Doc. Documentation
  Accessible without login HTML file ExtensionBuilder.html Doc. Documentation
  Accessible without login HTML file FileBuilder.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login HTML file InterfaceFileBuilder.html Doc. Documentation
  Accessible without login HTML file MainIndexBuilder.html Doc. Documentation
  Accessible without login HTML file NamespaceIndexBuilder.html Doc. Documentation
  Accessible without login HTML file PhpDomainBuilder.html Doc. Documentation
  Accessible without login HTML file RstBuilder.html Doc. Documentation
  Accessible without login HTML file TraitFileBuilder.html Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Extension  
File Role Description
  Accessible without login HTML file AddFullElementNameExtension.html Doc. Documentation
  Accessible without login HTML file Extension.html Doc. Documentation
  Accessible without login HTML file GithubLocationExtension.html Doc. Documentation
  Accessible without login HTML file HideChildNamespaces.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login HTML file InterfaceImplementors.html Doc. Documentation
  Accessible without login HTML file NoPrivateExtension.html Doc. Documentation
  Accessible without login HTML file PublicOnlyExtension.html Doc. Documentation
  Accessible without login HTML file TocExtension.html Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Middleware  
File Role Description
  Accessible without login HTML file ErrorHandlingMiddleware.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _sources  
File Role Description
Files folder imageapi (2 files, 1 directory)
  Accessible without login Plain text file cli.rst.txt Doc. Documentation
  Accessible without login Plain text file extensions.rst.txt Doc. Documentation
  Accessible without login Plain text file index.rst.txt Doc. Documentation
  Accessible without login Plain text file usage.rst.txt Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _sources  /  api  
File Role Description
Files folder imageJuliusHaertl (1 directory)
  Accessible without login Plain text file index-namespaces-all.rst.txt Doc. Documentation
  Accessible without login Plain text file index.rst.txt Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _sources  /  api  /  JuliusHaertl  
File Role Description
Files folder imagePHPDocToRst (4 files, 3 directories)

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _sources  /  api  /  JuliusHaertl  /  PHPDocToRst  
File Role Description
Files folder imageBuilder (10 files)
Files folder imageExtension (9 files)
Files folder imageMiddleware (2 files)
  Accessible without login Plain text file ApiDocBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file GenerateDocumentationCommand.rst.txt Doc. Documentation
  Accessible without login Plain text file index.rst.txt Doc. Documentation
  Accessible without login Plain text file WriteException.rst.txt Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _sources  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Builder  
File Role Description
  Accessible without login Plain text file ClassFileBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file ExtensionBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file FileBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file index.rst.txt Doc. Documentation
  Accessible without login Plain text file InterfaceFileBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file MainIndexBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file NamespaceIndexBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file PhpDomainBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file RstBuilder.rst.txt Doc. Documentation
  Accessible without login Plain text file TraitFileBuilder.rst.txt Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _sources  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Extension  
File Role Description
  Accessible without login Plain text file AddFullElementNameExtension.rst.txt Doc. Documentation
  Accessible without login Plain text file Extension.rst.txt Doc. Documentation
  Accessible without login Plain text file GithubLocationExtension.rst.txt Doc. Documentation
  Accessible without login Plain text file HideChildNamespaces.rst.txt Doc. Documentation
  Accessible without login Plain text file index.rst.txt Doc. Documentation
  Accessible without login Plain text file InterfaceImplementors.rst.txt Doc. Documentation
  Accessible without login Plain text file NoPrivateExtension.rst.txt Doc. Documentation
  Accessible without login Plain text file PublicOnlyExtension.rst.txt Doc. Documentation
  Accessible without login Plain text file TocExtension.rst.txt Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _sources  /  api  /  JuliusHaertl  /  PHPDocToRst  /  Middleware  
File Role Description
  Accessible without login Plain text file ErrorHandlingMiddleware.rst.txt Doc. Documentation
  Accessible without login Plain text file index.rst.txt Doc. Documentation

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _static  
File Role Description
Files folder imagecss (2 files)
Files folder imagefonts (1 file)
Files folder imagejs (2 files)
  Accessible without login Image file ajax-loader.gif Icon Icon image
  Accessible without login Plain text file basic.css Data Auxiliary data
  Accessible without login Image file comment-bright.png Icon Icon image
  Accessible without login Image file comment-close.png Icon Icon image
  Accessible without login Image file comment.png Icon Icon image
  Accessible without login Plain text file doctools.js Data Auxiliary data
  Accessible without login Plain text file documentation_options.js Data Auxiliary data
  Accessible without login Image file down-pressed.png Icon Icon image
  Accessible without login Image file down.png Icon Icon image
  Accessible without login Image file file.png Icon Icon image
  Accessible without login Plain text file jquery.js Data Auxiliary data
  Accessible without login Plain text file language_data.js Data Auxiliary data
  Accessible without login Image file minus.png Icon Icon image
  Accessible without login Image file plus.png Icon Icon image
  Accessible without login Plain text file pygments.css Data Auxiliary data
  Accessible without login Plain text file searchtools.js Data Auxiliary data
  Accessible without login Plain text file style.css Data Auxiliary data
  Accessible without login Plain text file underscore.js Data Auxiliary data
  Accessible without login Image file up-pressed.png Icon Icon image
  Accessible without login Image file up.png Icon Icon image
  Accessible without login Plain text file websupport.js Data Auxiliary data

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _static  /  css  
File Role Description
  Accessible without login Plain text file badge_only.css Data Auxiliary data
  Accessible without login Plain text file theme.css Data Auxiliary data

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _static  /  fonts  
File Role Description
  Accessible without login Plain text file fontawesome-webfont.svg Data Auxiliary data

  Files folder image Files (161)  /  docs  /  _build  /  html  /  _static  /  js  
File Role Description
  Accessible without login Plain text file modernizr.min.js Data Auxiliary data
  Accessible without login Plain text file theme.js Data Auxiliary data

  Files folder image Files (161)  /  docs  /  _static  
File Role Description
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files (161)  /  docs  /  _templates  
File Role Description
  Accessible without login HTML file layout.html Doc. Documentation

  Files folder image Files (161)  /  example  
File Role Description
  Plain text file test-example.php Class Class source

  Files folder image Files (161)  /  src  
File Role Description
Files folder imageBuilder (9 files)
Files folder imageExtension (8 files)
Files folder imageMiddleware (1 file)
  Plain text file ApiDocBuilder.php Class Class source
  Plain text file GenerateDocumentationCommand.php Class Class source
  Plain text file WriteException.php Class Class source

  Files folder image Files (161)  /  src  /  Builder  
File Role Description
  Plain text file ClassFileBuilder.php Class Class source
  Plain text file ExtensionBuilder.php Class Class source
  Plain text file FileBuilder.php Class Class source
  Plain text file InterfaceFileBuilder.php Class Class source
  Plain text file MainIndexBuilder.php Class Class source
  Plain text file NamespaceIndexBuilder.php Class Class source
  Plain text file PhpDomainBuilder.php Class Class source
  Plain text file RstBuilder.php Class Class source
  Plain text file TraitFileBuilder.php Class Class source

  Files folder image Files (161)  /  src  /  Extension  
File Role Description
  Plain text file AddFullElementNameExtension.php Class Class source
  Plain text file Extension.php Class Class source
  Plain text file GithubLocationExtension.php Class Class source
  Plain text file HideChildNamespaces.php Class Class source
  Plain text file InterfaceImplementors.php Class Class source
  Plain text file NoPrivateExtension.php Class Class source
  Plain text file PublicOnlyExtension.php Class Class source
  Plain text file TocExtension.php Class Class source

  Files folder image Files (161)  /  src  /  Middleware  
File Role Description
  Plain text file ErrorHandlingMiddleware.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:43
This week:0
All time:10,838
This week:560Up