soliangD / lumen-yaml-swagger by soliang

使用 yaml格式文档生成swagger接口文档
1
0
0
Package Data
Maintainer Username: soliang
Maintainer Contact: soliang@dingtalk.com (soliang)
Package Create Date: 2019-04-09
Package Last Update: 2019-04-10
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 15:24:00
Package Statistics
Total Downloads: 1
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 0
Total Forks: 0
Total Open Issues: 0

LumeYamlSwagger

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 文档