chriha/laravel-api-documentation
Composer 安装命令:
composer require chriha/laravel-api-documentation
包简介
description
README 文档
README
This package helps providing a parsed Swagger documentation by using your OpenAPI YAML files.
Getting Started
Installation
composer require chriha/laravel-api-documentation
Path to your specification
By default, the OpenAPI YAML specifications should be inside ./resources/api/.... In this directory, you can
create a file for each version, e.g. v1.yml, v2.yml, v3.yml and so on.
API version info
Each version (file) will provide an endpoint (e.g. v1.yml leads to /api/v1) with all the information, specified
under the info key:
... info: version: "v1.0.1" title: "Awesome API" contact: email: "awesome@api.info.com" ...
... will result to the following response body:
{
"version": "v1.0.1",
"title": "Awesome API",
"contact": {
"email": "awesome@api.info.com"
}
}
Documentation
Will be available via the URI /docs/api/[VERSION] and the file at /docs/api/[VERSION]/file.
Configuration
If you would like to change the default configuration, you can publish and update it to your needs:
php artisan vendor:publish --provider="Chriha\ApiDocumentation\ApiDocumentationServiceProvider"
Configuration will then be available in ./config/api-documentation.php.
Specifications path and naming format
You can change the path to your specifications and the format of your files via the specifications key in the
configuration.
Changing the middleware
By default, the documentation uses the web-, the API info endpoint the api-middleware. You can change this in the
configuration by changing the middleware key.
Hiding information
If you want to hide keys from the info endpoint (e.g. /api/v1), you can specify those in the configuration
under specifications.hide via "dot" notation.
'specifications' => [ 'hide' => [ 'v1' => [ 'contact.email', 'description', ] ], ],
Development
Conventional Commits
Please use conventional commits for automated semantic versioning, if you submit your merge request.
Dry Run Semantic Release
npm i @semantic-release/changelog @semantic-release/git @semantic-release/exec -D GITHUB_TOKEN=YOUR_GITHUB_TOKEN npx semantic-release --dry-run --no-ci
Contributing
Please read CONTRIBUTING.md for details on the code of conduct, and the process for submitting pull requests.
chriha/laravel-api-documentation 适用场景与选型建议
chriha/laravel-api-documentation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.99k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 chriha/laravel-api-documentation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chriha/laravel-api-documentation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.99k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-17
