1 Star 0 Fork 2

阿伟先生 / l5-swagger-bootstrap-ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

l5-swagger-bootstrap-ui

[![Latest Version on Packagist][ico-version]][link-packagist] [![Total Downloads][ico-downloads]][link-downloads] ![Software License][ico-license]

简介

l5-swagger-bootstrap-uiSwagger的前端UI实现,目的是替换Swagger默认的UI实现Swagger-UI,使文档更友好一点儿....

l5-swagger-bootstrap-ui 只是Swagger的UI实现,并不是替换Swagger功能,所以后端模块依然是依赖Swagger的,需要配合Swagger的注解达到效果

声明

l5-swagger-bootstrap-ui 的前端界面使用bootstrap实现

Javascript逻辑参考项目 https://github.com/xiaoymin/Swagger-Bootstrap-UI已经获得作者授权。

项目依赖于 https://github.com/DarkaOnLine/L5-Swagger, 安装l5-swagger-bootstrap-ui的时候,L5-Swagger会被自动安装,关于L5-Swagger的配置及api-docs.json文件的生成, 都参考L5-Swagger[https://github.com/DarkaOnLine/L5-Swagger/blob/master/README.md]

安装方法

  • 首先composer需要引入x-class/l5-swagger-bootstrap-ui包,如下:

composer require x-class/l5-swagger-bootstrap-ui

  • Laravel>=5.5以上版本会自动引用Provider

  • 需要先运行L5-Swagger的publish命令生成配置文件

php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"

  • 再运行l5-swagger-bootstrap-ui的publish命令生成视图文件

php artisan vendor:publish --provider "L5SwaggerBootStrapUi\L5SwaggerBootStrapUiServiceProvider"

  • 最后再相关的控制器文件中编写Swagger注释后,运行api-docs.json文件生成命令

php artisan l5-swagger:generate

  • 浏览器打开网址http://youdomain/api/documentation即可访问,如果要修改网址或其他配置信息, 请参考L5-Swagger[https://github.com/DarkaOnLine/L5-Swagger/blob/master/README.md]

注意:

生成api-docs.json文件的时候可能会的报错,主要是L5-Swagger依赖的Swagger版本导致的, 如果你的swagger-php>=3.0

请修改.env文件增加 SWAGGER_VERSION=3.0

或者config/l5-swagger.php中的2.0改为3.0

'swagger_version' => env('SWAGGER_VERSION', '3.0'),

如果你的swagger-php<3.0或者使用的是旧版本的语法 @SWG (SWAGGER annotations) !!!请运行安装旧版本的swagger-php

composer require 'zircote/swagger-php:2.*'

功能

  • 接口文档说明,效果图如下:

  • 在线调试功能,效果图如下:

Swagger简介

Swagger 是一个规范和完整的框架,用于生成、描述、调用和可视化 RESTful 风格的 Web 服务。总体目标是使客户端和文件系统作为服务器以同样的速度来更新。文件的方法,参数和模型紧密集成到服务器端的代码,允许API来始终保持同步。Swagger 让部署管理和使用功能强大的API从未如此简单。

Swagger-UI默认效果图如下:

MIT License Copyright (c) 2018 阿伟先生 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于laravel的swagger自定义UI 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/x-class/l5-swagger-bootstrap-ui.git
git@gitee.com:x-class/l5-swagger-bootstrap-ui.git
x-class
l5-swagger-bootstrap-ui
l5-swagger-bootstrap-ui
master

搜索帮助