定制 bchalier/laravel-openapi-autodoc 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bchalier/laravel-openapi-autodoc

最新稳定版本:0.2.2

Composer 安装命令:

composer require bchalier/laravel-openapi-autodoc

包简介

Automatic documentation of laravel in OpenApi format.

README 文档

README

Generates OpenAPI v3 documentation from your Laravel routes, FormRequests and API Resources.

Compatible with Laravel 10–12 and PHP 8.1–8.4.

Install

  1. Require the package in your app (Composer path repo supported):

  2. Publish the config if you need to customize:

php artisan vendor:publish --tag=config --provider="Bchalier\LaravelOpenapiDoc\App\Providers\LoadingServiceProvider"

Usage

  • Generate the JSON file:
    • php artisan documentation:generate
  • Output file:
    • Stored on the public disk at storage/app/public/documentation/openapi.json.
    • If you’ve run php artisan storage:link, it’s available at /storage/documentation/openapi.json.

How it works

  • Parses route list and filters via config/documentation.php.
  • Infers request schemas from FormRequest validation rules.
  • Infers response schemas from return types: JsonResource, ResourceCollection, JsonResponse.
  • Uses docblocks for operation summary/description and @throws to add error responses.

Notes

  • Models instantiated for resources must use Illuminate\Database\Eloquent\Factories\HasFactory.
  • When route names are missing, operationId falls back to <method>_<uri>.

统计信息

  • 总下载量: 14.85k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-10