pfaciana / render-docs
显示来自render-docs json数据文件的HTML文档页面
1.0.2
2021-06-03 01:31 UTC
Requires
- ext-ctype: *
- ext-json: *
- mikecao/flight: ^1
This package is auto-updated.
Last update: 2024-09-04 14:43:26 UTC
README
从npm包parse-php-to-json
获取输出json文件,并将文档渲染为可读的HTML页面。
示例使用
安装
composer require pfaciana/render-docs
运行
将此代码放在您的Web服务器上。在最简单的形式中,您只需调用RenderDocs()
并告知它JSON文件的位置(由parse-php-to-json
输出)。然后在您的网页浏览器中查看此页面。
<?php require_once __DIR__ . '/vendor/autoload.php'; RenderDocs([ 'docRoot' => __DIR__ . '/../docs/', // Required. Location of the JSON files (Projects grouped as sub-directories) 'editorUrl' => 'http://localhost:1234/api/file/', // Optional. If you have an IDE installed, this will prefix a link to open the file (if it exists locally) in your IDE. 'locationFilter' => function ($file) { /* alter filepath */ return $file; }, // Optional. Used with `editorUrl`, if the file exists in a different location locally than in the repo, this is a filter that allows you to alter the filepath so that you can link to it locally. ]);