world-warm-worm/autodoc
最新稳定版本:6.0.0
Composer 安装命令:
composer require world-warm-worm/autodoc
包简介
Generates documentation of classes methods in several file formats
README 文档
README
What can a library do?
Documents methods of any class, regardless of access modifiers, in two json and yaml formats. All you need to
do is call the constructor of the JsonAutodoc or YamlAutodoc class, throw an object of the class into it, the
methods of which need to be documented and comply with the requirement that the documented class implement the
EndpointInterface interface. Where can I call the constructor of the JsonAutodoc or YamlAutodoc class? It depends
on your needs. For example, I'm in my project the JsonAutodoc constructor was called in the constructor body of the
class, which is an API for a third-party service. This way, the documentation is reassembled every time the API
endpoint is called and is always up to date.
Hou to use?
$objectToDocument = new MyClass(); new JsonAutodoc($objectToDocument)->generate( "The documentation of " . $objectToDocument::class . " endpoints", '/path/to/file' ); new YamlAutodoc($objectToDocument)->generate( "The documentation of " . $objectToDocument::class . " endpoints", '/path/to/file' );
Usage examples
/tests/EndpointAutodocTest.php
/src/Api/Product/Controller/ProductController.php
What if my project is written on the symfony/laravel/yii framework?
The library is easily integrated. You can use this approach: if you work on any of the modern MVC frameworks, then generate your own documentation file for each controller. Select another controller, where there will be a list links to the documentation of all other controllers as in the example with the file index.php this library. This way it will be possible for any of the colleagues on the project (not just the programmer) to have an idea of how the controllers in the project or API work.
What if I want to use your library, but my project doesn't have composer?
Download the zip from my repository and unzip the library folder. To work with the library, you will only
need the /src/Autodoc folder, but it uses the namespaces specified in /composer.json in its files. The files may
not be located in your project. Most likely, you will need to replace the library's namespaces with your own.
That's all
If you want to join to develop this project - you are welcome in pull requests. If you find smth not working you are welcome to issues.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2025-08-26