2017 © Pedro Peláez
 

symfony-bundle phpdoc2rst

PHPDoc to RST

image

patgod85/phpdoc2rst

PHPDoc to RST

  • Wednesday, January 24, 2018
  • by patgod85
  • Repository
  • 1 Watchers
  • 0 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Phpdoc2rst

The tool for building of documentation for shared API in reStructuredText format, (*1)

For main API entities, (*2)

Preview, (*3)

we can generate rst-files with data stored in PhpDoc annotations. Examples of results can be found here ., (*4)

Installation:, (*5)

composer require patgod85/phpdoc2rst

The tool implemented as a bundle for Symfony 2 and provides 2 commands:, (*6)

php app/console phpdoc2rst:process

The command generates rst-files for specified target (Controllers, Models of Exceptions), (*7)

arguments:, (*8)

  1. namespace - The namespace to process;
  2. path - The path the namespace can be found in;

options:, (*9)

  • --output, -o - The path to output the ReST files;
  • --title, -t - An alternate title for the top level namespace;
  • --exclude, -x - Semicolon separated namespaces to ignore;
  • --target - Which elements need to select. Default value 'properties';
  • --groups - Allows to fetch only properties of required group. A string divided by commas. Default value '';
  • --header - Set the weight of main header for target==properties. Available options "h1" and "h2". Default value is "h1"
php app/console phpdoc2rst:all

The command is a runner of several phpdoc2rst:process that specified in config.yml of the project, (*10)

Example of config.yml section, (*11)

patgod85_phpdoc2rst:
    errors_provider: my_bundle.errors
    tasks:
        email:
            subtasks:
                default:
                    target: 'properties'
                    namespace: 'MyBundle\Model'
                    input: '%kernel.root_dir%/../src/MyBundle/Model'
                    output: '%kernel.root_dir%/../src/MyBundle/Resources/views/model'
                    groups: Export,Create
                    header: h2

For "properties" mode the annotation JMS\Serializer\Annotation\VirtualProperty should be counted, (*12)

To update the bundle:

  1. Commit the changes
  2. Add a tag with version number
  3. Push
  4. Run composer require patgod85/phpdoc2rst:0.0.17 in the customer project

The Versions