evolvo/swagger-doc-generators
Composer 安装命令:
composer require evolvo/swagger-doc-generators
包简介
Artisan commands to generate comments for swagger.
README 文档
README
About
The swagger-doc-generators package allows you to create comments from validation classes for swagger documentation.
Installation
Require the evolvo/swagger-doc-generators package in your composer.json and update your dependencies:
$ composer require evolvo/swagger-doc-generators "1.0.8"
add
Evolvo\SwaggerDocGenerators\SwaggerDocGeneratorsServiceProvider::class,
to config/app.php 'providers' array.
####If you don't have swagger config and view files:
Run:
php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"
then add
L5Swagger\L5SwaggerServiceProvider::class,
to config/app.php 'providers' array.
Add to app/Http/Controllers/Controller.php:
/** * @OA\Info( * version="1.0.0", * title="L5 OpenApi", * description="L5 Swagger OpenApi description", * @OA\License( * name="Apache 2.0", * url="http://www.apache.org/licenses/LICENSE-2.0.html" * ) * ) */ /* * @SWG\SecurityScheme( * securityDefinition="passport", * type="oauth2", * tokenUrl="/oauth/token", * flow="password", * scopes={} * ) */ class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; }
add to .env file:
L5_SWAGGER_GENERATE_ALWAYS=TRUE.
Default preview route is http://your-address.com/api/documentation, but you can change it in configuration.
Usage
Run php artisan comment {METHOD::route} to generate comment for route. You can specify multiple routes.
Run php artisan comment:controller {controller} to generate comments for whole controller.
Examples
For single route
php artisan comment GET::api/clients
For multiple routes
php artisan comment GET::api/clients POST::api/clients PUT::api/clients/{client}
For controller
php artisan comment:controller ClientsController
Custom documentation style
Run php artisan swagger-custom-style:apply to apply custom style.
After that go to config/l5-swagger.php and change style in css array.
Run php artisan swagger-custom-style:remove to remove custom style.
Links and examples
Swagger PHP: here
More about swagger for laravel: l5-swagger.
L5-swagger documentation example: pet store.
Pet store code example: link.
Our company: http://evolvo.eu.
evolvo/swagger-doc-generators 适用场景与选型建议
evolvo/swagger-doc-generators 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 590 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 evolvo/swagger-doc-generators 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 evolvo/swagger-doc-generators 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 590
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-25
