Analyze PHP class and docBlock to generate API Documentation.
DocTracer helps you to create meaningful API documentation reports. Reflecting PHP class information and show markdown formatted documentation on one page.
How to use:
$tracer = new \Mdz\DocTracer($baseDir);
$tracer->inspect($targetDir);
echo $tracer->render();
@link | @link DocTracer |
@author | @author Mudzakkir me@mdzstack.com |
@copyright | @copyright Copyright (c) 2021 Mudzakkir |
@license | @license https://opensource.org/licenses/MIT |
@var | string |
Base directory path.
@var | string |
Holds all reports data.
@var | array |
@param | string | $baseDir |
Find, check and parse all PHP files.
PHP ReflectionClass require autoloader or class must exist.
@param | string | $targetDir | Directory to check |
@param | array | $exclude | Exclude directory |
@return | \Mdz\DocTracer |
Return reports information.
@return | array |
Find PHP files inside directory recursively.
@param | string | $path | |
@param | array | $exclude |
@return | \Iterator | of \SplFileInfo |
Get fully qualified namespace from content.
@param | string | $content |
@return | string | Fully qualified namespace |
Get class constants information.
@param | \ReflectionClass | $refClass | |
@param | string | $fqnClass |
@return | array |
Get class properties information.
@param | \ReflectionClass | $refClass | |
@param | string | $fqnClass |
@return | array |
Get class methods information.
@param | \ReflectionClass | $refClass | |
@param | string | $fqnClass |
@return | array |
Get method parameters information.
@param | \ReflectionMethod | $refMethod |
@return | array |
Get the type hint
@param | \ReflectionType | $refType |
@return | string |
Check the type of reflection $value to printable value.
Word "n/a" to differentiate between the assigned default value "null" and the null returned by reflection when a default value is not assigned.
@param | mixed|null | $value |
@return | string|int |
Get DocBLock informations.
@param | \Reflector | $ref | Has the |
@return | array |
Render in HTML page.
Available setting:
title
Page heading (h1) and meta titletagline
Page heading taglinefooter
Footer information. Default: {title} - {tagline}
theme
Report theme. Options: default
, darkmoon
css
Customize the report styletemplate
Custom template path@param | array | $setting |
@return | string |
Standarize the documentation HTML format.
The class, constant, property and method share the same HTML output.
@param | array | $docBlock |
@return | string |
Pretify documentation with Markdown.
@link | @link Markdown basic |
@link | @link Markdown extra |
@param | string | $content |
@return | string |
Break part namespace and types with ​
zero-width space.
@param | string | $content |
@return | string |