hms5232/laravel-swagger
Composer 安装命令:
composer require hms5232/laravel-swagger
包简介
Render OpenAPI JSON or YAML with SwaggerUI in Laravel.
README 文档
README
Render OpenAPI JSON or YAML with SwaggerUI and/or Swagger Editor in Laravel.
Usage
Installation
composer require hms5232/laravel-swagger
or you want to install only at development environment:
composer require hms5232/laravel-swagger --dev
Configure
All configurable items are in config/swagger.php after you run publish command:
php artisan vendor:publish --provider "Hms5232\LaravelSwagger\LaravelSwaggerServiceProvider"
If you want to override the exists config file, execute command with --force flag.
See the config file for detail information.
Manually register
Package support auto-discovery. If you want to control when to register, you can do the following steps:
-
Edit
composer.jsonmake auto discovery ignore laravel-swagger:"extra": { "laravel": { "dont-discover": [ "hms5232/laravel-swagger" ] } },
-
Re-generate optimized autoload files:
composer dump-autoload
-
Edit
app/Providers/AppServiceProvider.phpdefine when to register:use Hms5232\LaravelSwagger\LaravelSwaggerServiceProvider; // add this class AppServiceProvider extends ServiceProvider { public function register() { // set condition // for example, only register when env is "local" if ($this->app->environment('local')) { $this->app->register(LaravelSwaggerServiceProvider::class); // register laravel-swagger } } }
Why another package
I just want to write a YAML file directly, and use Swagger UI serve/resolve docs.
But exists projects are either using annotations or only supporting JSON (seems like bug, but does not fix.).
So I develop this package, only have a view modified from Swagger UI (unpkg), two routes to link documents.
This section was written at version 0.1.0 and may be outdated in the future.
LICENSE
hms5232/laravel-swagger 适用场景与选型建议
hms5232/laravel-swagger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.95k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 10 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hms5232/laravel-swagger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hms5232/laravel-swagger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.95k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-26