PHP code example of devtools / docgen

1. Go to this page and download the library: Download devtools/docgen library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

devtools / docgen example snippets




use Devtools\Docgen\Outer;
use Devtools\Docgen\Parser;
use Devtools\Docgen\Scaner;

er->setSuffixs([
    '.php'
]);
$parser = new Parser($scaner);
$overview = $parser->getOverview(); //获取文档总概况
$apis = $parser->getApis();         //获取接口对象数组

$outer = new Outer($parser);

//生成markdown文件
$link = $outer->toMarkDown([
    //'stream' => 'php://stdout',   //输出到控制台
    'stream' => __DIR__ . '/Doc/api.md',       //输出到指定文件
]);
if (is_file($link)) {
    echo "== markdown文档链接 ==" . PHP_EOL . $link . PHP_EOL . PHP_EOL;
}

//生成html文件
$link = $outer->toHtml([
    //'stream' => 'php://stdout',   //输出到控制台
    'stream' => __DIR__ . '/Doc/api.html',       //输出到指定文件
]);
if (is_file($link)) {
    echo "== html文档链接 ==" . PHP_EOL . $link . PHP_EOL . PHP_EOL;
}