soliangd/lumen-yaml-swagger

使用 yaml格式文档生成swagger接口文档

1.0.0 2019-04-10 15:19 UTC

This package is auto-updated.

Last update: 2024-04-29 04:07:15 UTC


README

Swagger 2.0 for Lumen 5

SwaggerLume 进行封装。 使其支持YAML文档。

安装

composer require --dev soliangd/lumen-yaml-swagger

bootstrap/app.php

  • 去掉门面注释:
         $app->withFacades();
  • 复制配置并加载:
         $app->configure('yaml-swagger');
  • 注册服务:
        $app->register(\Soocoo\Swagger\SwaggerLumenServiceProvider::class);
  • 配置YAML目录 config/yaml-swagger.php
    [
        "paths" => [
            "yaml_annotations" => [base_path('docs')] // 默认目录
        ]
    ]
  • 路由重定向
    注意nginx配置时将 swagger路由重定向 swagger文档支持
         location ~ /(swagger-ui-assets) {
             index index.php;
             try_files $uri $uri/ /index.php?$query_string;
         }
    ````php

其它使用见 SwaggerLume 文档