g4t / 文档
自动生成 Laravel API 文档
1.2.1
2021-10-03 07:09 UTC
Requires
- illuminate/support: ~7|~8
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
README
您可以使用这个库轻松地为您的API创建文档
安装
使用以下命令通过 composer 安装此包:
composer require g4t/documentation
php artisan vendor:publish --provider=g4t\Documentation\DocumentationServiceProvider
默认端点
对于文档 http://yoururl/g4t/doc
对于 JSON http://yoururl/g4t/json
您可以从 config/documentation.php 中更改这些端点
<?php return [ 'json_url' => 'g4t/json', 'documentation_url' => 'g4t/doc' ];
用法
当您在 api.php 中创建路由时,此包将自动工作。
如果您在请求体或查询参数中发送数据,您应该在函数前添加一些注释。
您有两种方式可以使用它:
💥 1 - 通过使用自动数据库模式检测
示例
/** * start FunctionName function * title: Create Users * table: users * remove: ["remember_token", "email_verified_at"] * replace: {"password": "password", "email": "email", "image": "file"} * end FunctionName function */
注释说明
💥 2 - 手动
示例
/** * start FunctionName function * auth * title: get user by id * string $name required * int $number * email $email required * password $password * file $image * end FunctionName function */
注释说明
许可协议
Laravel Dark 文档生成器是免费软件,遵循 MIT 许可协议。