soliangd/lumen-yaml-swagger

使用 yaml格式文档生成swagger接口文档
2
Install
composer require soliangd/lumen-yaml-swagger
Latest Version:1.0.0
PHP:>=7.1.3
License:MIT
Last Updated:Apr 10, 2019
Links: GitHub  ·  Packagist
Maintainer: soliang

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