apex/docs-generator
Composer 安装命令:
composer require apex/docs-generator
包简介
Automatically generate docs for all classes and methods
README 文档
README
Automatically generates static developer documentation for either, a single PHP class or all classes within a project directory. Theme based allowing results to be easily styled any way you wish, and comes with support for basic HTML, markdown and Syrus formats.
Some example of generated documentation:
Class: https://apexpl.io/docs/classes/svc/convert/
Method: https://apexpl.io/docs/classes/svc/convert/case
Installation
Install via Composer with:
composer require apex/docs-generator
Table of Contents
You will only ever need two methods within the the Apex\Docs\DocsGenerator class:
Usage
Generate Docs for Single Class
use Apex\Docs\docsGenerator; / Set some variables $class_name = "App\\MyPackage\\Controllers\\OrderController"; $dest_dir = "/path/to/docs/order_controller"; $base_uri = "/docs/"; // Generate single class $generator = new DocsGenerator(); $generator->generateClass($class_name, $dest_dir, $base_uri, 'html');
The last parameter in the generateClass() function is the theme to use. All themes can be found within /themes/ of the installation directory, and by default supports three themes - html, markdown, syrus
The above will create a blank directory at /path/to/docs/order_controller, an index.html file inside that lists all methods within the class, each of which link to another method specific page.
** Generate Documentation for Directory of PHP Classes**
use Apex\Docs\docsGenerator; / Set some variables $source_dir = "/path/to/my_package"; $dest_dir = "/path/to/docs/"; $base_uri = "/docs/"; $base_namespace = "App\\MyPackage\\"; // Generate directory $generator = new DocsGenerator(); $generator->generateDirectory($source_dir, $dest_dir, $base_uri, $base_namespace, 'html');
This will go through all files and directories within $source_dir, and generate a new documentation directory for every PHP class found. I will also generate the necessary index pages within each root nameaspace that contains PHP casses, giving an overview of all classes within that namespace.
Syrus Integration
There is build-in support for Syrus if you so desire. If you wish to use this integration and are using Syrus outside of Apex, to enable the integration open the /config/container.php Syrus file and look for the item:
syrus.tag_namespaces
Within this array, add the entry:
Apex\\Docs\\SyrusTags
That's it. When generating documentation simply change the $theme paramter from "html" to "syrus", and it wll generate the documenation formatted for Syrus.
Apex
Brought to you by Apex Framework at https://apexpl.io/.
apex/docs-generator 适用场景与选型建议
apex/docs-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 183 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 07 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 apex/docs-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 apex/docs-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 183
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-16