gollumsf/rest-doc-bundle
Composer 安装命令:
composer require gollumsf/rest-doc-bundle
包简介
Auto-Generate documentation API for GollumSF\RestBundle
README 文档
README
Auto-Generate documentation API for GollumSF\RestBundle : https://github.com/GollumSF/rest-bundle
Requirements:
- PHP >= 8.2
- Symfony 6.4, 7.x or 8.0
Installation:
composer require gollumsf/rest-doc-bundle
config/bundles.php
return [ // [ ... ] GollumSF\RestBundle\GollumSFRestDocBundle::class => ['all' => true], ];
Configuration:
All configurations is optionals. Edit file config/packages/gollum_sf_rest_doc.yaml :
gollum_sf_rest_doc: ################# # Documentation # ################# title: 'REST Api' # optional, default : REST Api version: '1.0.0' # optional, default : 1.0.0 description: 'Api general description' # optional, default : null external_docs: # optional url: 'https://github.com/GollumSF/rest-doc-bundle' # required description: 'External documentation description' # optional, default : null ############## # Host / URL # ################ host: # optional, default : null (return current host url) - 'dev.api.com' - 'preprod.api.com' - 'prod.api.com' default_host: 'dev.api.com' # optional, default : null (return first item to host list) protocol: # optional, default : null (return current sheme url) - 'http' - 'https' default_protocol: 'http' # optional, default : null (return first item to protocol list) ############ # Security # ############ security: # optional (No security token if not defined) my_first_configuration: type: 'authorization_bearer' # required, authorization_bearer generate classic authorization bearer name: 'Authorization' # optional, default: Authorization, the header name scheme: 'BEARER' # optional, default: BEARER, the scheme in header value defaultValue: 'TOKEN_DEMO' # optional, the default token value for demo my_second_configuration: type: 'query_param' # required, query_param generate query string token name: 'token' # optional, default: token, the query name defaultValue: 'TOKEN_DEMO' # optional, the default token value for demo my_custom_configuration: type: 'custom' # required, custom generate a custom configuration based on: defaultValue: 'TOKEN_DEMO' # optional, the default token value for demo data: # required, Data based on securitySchemes content type: 'http' # - show : https://swagger.io/docs/specification/authentication/ scheme: 'basic'
Integration with Swagger:
#app/config/routing.yml gsf_restbundle_swagger: resource: "@GollumSFRestDocBundle/Resources/config/swagger_routing.yml" prefix: /api-docs
Integration with OpenApi JSON:
gsf_restbundle_openapi: resource: "@GollumSFRestDocBundle/Resources/config/openapi_routing.yml" prefix: /api-docs.json
Attributes:
The documentation is automatically generated from your controllers using #[Serialize] and #[Unserialize] attributes from RestBundle. No additional configuration is needed for basic API documentation.
You can optionally enrich the generated documentation with these attributes:
ApiDescribe (on controller methods)
Override or add metadata for a specific route:
use GollumSF\RestDocBundle\Annotation\ApiDescribe; #[ApiDescribe(entity: Book::class, serializeGroups: ['book_get'])] public function list() { ... }
ApiEntity (on entity classes)
Add description and URL metadata to an entity:
use GollumSF\RestDocBundle\Annotation\ApiEntity; #[ApiEntity(description: 'A book entity', url: '/api/books')] class Book { // ... }
ApiProperty (on entity properties)
Override the auto-detected type or description of a property:
use GollumSF\RestDocBundle\Annotation\ApiProperty; class Book { #[ApiProperty(type: 'integer')] private int $id; #[ApiProperty(type: 'string')] private string $title; }
gollumsf/rest-doc-bundle 适用场景与选型建议
gollumsf/rest-doc-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 480 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「documentation」 「rest」 「api」 「swagger」 「openapi」 「gollumsf」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gollumsf/rest-doc-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gollumsf/rest-doc-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gollumsf/rest-doc-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
Laravel API documentation generating tool
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
统计信息
- 总下载量: 480
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2020-01-28