liaosp/think-swagger 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

liaosp/think-swagger

Composer 安装命令:

composer require liaosp/think-swagger

包简介

thinkphp apidoc gen think-swagger swaggerv3

README 文档

README

thinkphp5 自动生成swagger文档 swagger-ui

Latest Stable Version Total Downloads Daily Downloads License StyleCI

TP6 后续发布

Installing

$ composer require liaosp/think-swagger -vvv

Usage

安装好后,在application 下的任意文件写入:

     /**
      * @OA\Info(
      *      version="1.0.0",
      *      title="OpenApi",
      *      description="Swagger OpenApi description",
      *      @OA\Contact(
      *          email="darius@matulionis.lt"
      *      ),
      *     @OA\License(
      *         name="Apache 2.0",
      *         url="http://www.apache.org/licenses/LICENSE-2.0.html"
      *     )
      * )
      */
 
     /**
      * @OA\Get(
      *      path="/projects/{id}",
      *      operationId="getProjectById",
      *      tags={"Projects"},
      *      summary="Get project information",
      *      description="Returns project data",
      *      @OA\Parameter(
      *          name="id",
      *          description="Project id",
      *          required=true,
      *          in="path",
      *          @OA\Schema(
      *              type="integer"
      *          )
      *      ),
      *      @OA\Response(
      *          response=200,
      *          description="successful operation"
      *       ),
      *      @OA\Response(response=400, description="Bad request"),
      *      @OA\Response(response=404, description="Resource Not Found"),
      *      security={
      *         {
      *             "oauth2_security_example": {"write:projects", "read:projects"}
      *         }
      *     },
      * )
      */

访问:

你的域名/apidoc

如果你想扫描指定的文件目录,在config/app.php 添加绝对路径

'swagger_path' =>'绝对路径 __DIR__ 自定义'

更多用法可参考我之前写的博客相关

swagger 使用

如何写composer包

如何写这个包

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固