2017 © Pedro Peláez
 

library markdowndocs

Command line tool for generating markdown-formatted class documentation

image

victorjonsson/markdowndocs

Command line tool for generating markdown-formatted class documentation

  • Monday, March 5, 2018
  • by vic
  • Repository
  • 3 Watchers
  • 53 Stars
  • 265,571 Installations
  • PHP
  • 35 Dependents
  • 0 Suggesters
  • 13 Forks
  • 6 Open issues
  • 18 Versions
  • 2 % Grown

The README.md

PHP-Markdown-Documentation-Generator

Documentation is just as important as the code it's refering to. With this command line tool you will be able to write your documentation once, and only once!, (*1)

This project will write a single-page markdown-formatted API document based on the DocBlock comments in your source code., (*2)

Travis, (*3)

Example

Let's say you have your PHP classes in a directory named "src". Each class has its own file that is named after the class., (*4)

- src/
  - MyObject.php
  - OtherObject.php

Write your code documentation following the standard set by phpdoc., (*5)

namespace Acme;

/**
 * This is a description of this class
 */
class MyObject {

   /**
    * This is a function description
    * @param string $str
    * @param array $arr
    * @return Acme\OtherObject
    */
   function someFunc($str, $arr=array()) {

   }
}

Then, running $ phpdoc-md generate src > api.md will write your API documentation to the file api.md., (*6)

Here you can see a rendered example, (*7)

Only public and protected functions will be a part of the documentation, but you can also add @ignore to any function or class to exclude it from the docs. Phpdoc-md will try to guess the return type of functions that don't explicitly declare one. The program uses reflection to get as much information as possible out of the code so that functions that are missing DocBlock comments will still be included in the generated documentation., (*8)

Requirements

  • PHP version >= 5.3.2
  • Reflection must be enabled in php.ini
  • Each class must be defined in its own file with the file name being the same as the class name
  • The project should use Composer

Installation / Usage

This command line tool can be installed using composer., (*9)

From the local working directory of the project that you would like to document, run:, (*10)

$ composer require --dev victorjonsson/markdowndocs

This will add victorjonsson/markdowndocs to the require-dev section of your project's composer.json file. The phpdoc-md executable will automatically be copied to your project's vendor/bin directory., (*11)

Generating docs

The generate command generates your project's API documentation file. The command line tool needs to know whether you want to generate docs for a certain class, or if it should process every class in a specified directory search path., (*12)

# Generate docs for a certain class
$ ./vendor/bin/phpdoc-md generate Acme\\NS\\MyClass 

# Generate docs for several classes (comma separated)
$ ./vendor/bin/phpdoc-md generate Acme\\NS\\MyClass,Acme\\OtherNS\\OtherClass 

# Generate docs for all classes in a source directory
$ ./vendor/bin/phpdoc-md generate includes/src

# Generate docs for all classes in a source directory and send output to the file api.md
$ ./vendor/bin/phpdoc-md generate includes/src > api.md
  • Note that any class to be documented must be loadable using the autoloader provided by composer. *
Bootstrapping

If you are not using the composer autoloader, or if there is something else that needs to be done before your classes can be instantiated, then you may request phpdoc-md to load a php bootstrap file prior to generating the docs, (*13)

$ ./vendor/bin/phpdoc-md generate --bootstrap=includes/init.php includes/src > api.md, (*14)

Excluding directories

You can tell the command line tool to ignore certain directories in your class path by using the --ignore option., (*15)

$ ./phpdoc-md generate --ignore=test,examples includes/src > api.md, (*16)

The Versions

05/03 2018

dev-master

9999999-dev https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

20/04 2017

1.3.8

1.3.8.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

11/10 2016

1.3.7

1.3.7.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

12/02 2016

1.3.5

1.3.5.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

12/02 2016

1.3.4

1.3.4.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

12/02 2016

1.3.2

1.3.2.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

11/02 2016

1.3.1

1.3.1.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

11/02 2016

1.3.0

1.3.0.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

16/11 2015

1.2.16

1.2.16.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

16/11 2015

1.2.15

1.2.15.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

16/11 2015

1.2.14

1.2.14.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

23/02 2015

1.2.13

1.2.13.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

23/02 2015

1.2.12

1.2.12.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

21/02 2015

1.2.11

1.2.11.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

13/02 2015

1.2.8

1.2.8.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

05/02 2015

1.2.4

1.2.4.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

04/02 2015

1.2.3

1.2.3.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires

04/02 2015

1.2.2

1.2.2.0 https://github.com/victorjonsson/PHP-Markdown-Documentation-Generator

Command line tool for generating markdown-formatted class documentation

  Sources   Download

MIT

The Requires

 

The Development Requires