elenyum/open-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

elenyum/open-api

最新稳定版本:1.0

Composer 安装命令:

composer require elenyum/open-api

包简介

This bundle generates documentation and returns JSON formatted according to the OpenAPI specification.

README 文档

README

This bundle generates documentation and returns JSON formatted according to the OpenAPI specification.

Install

composer require elenyum/open-api

Configuration

For adding configuration, create a config file in the project root directory, /config/packages/elenyum_open_api.yaml. In the config file add:

elenyum_open_api:
    documentation:
        info:
            title: My project name
            description: My project description
            version: 1.0.0

To add a route to get the json specification add to project root file /config/routes/elenyum_open_api.yaml

width config example:

app.openapi:
  path: /v1/doc
  methods: GET
  defaults: { _controller: elenyum_open_api }

Cache Configuration

  • cache.enable:
    Indicates whether caching is activated. Default: false.

  • cache.item_id:
    Sets the cache item identifier. Default: elenyum_open_api.

Example:

yaml

cache:
  enable: true
  item_id: 'my_custom_cache_id'

Documentation Configuration

Serves as a foundation for creating API documentation using attributes as keys.

  • documentation.info.title:
    The title of the application in the documentation: My App.

  • documentation.info.description:
    The description of the application in the documentation: Description service.

  • documentation.info.version:
    The version of the application in the documentation: 1.0.0.

Example:

yaml

documentation:
  info:
    title: 'My App'
    description: 'Description service'
    version: '1.0.0'

Other Configuration

Filters the routes that will be documented and manages their visibility in the generated documentation.

  • path_patterns:
    An array of regex patterns to match against the path for including routes.

  • host_patterns:
    An array of regex patterns to match against the host for including routes.

  • name_patterns:
    An array of regex patterns to match against the route name for including routes.

  • with_tag:
    A boolean indicating if routes should be filtered by tag (annotations).

  • disable_default_routes:
    A boolean indicating if default routes without explicit OpenAPI annotations should be excluded.

Example

yaml

path_patterns: ['^/api']
host_patterns: ['^api\.']
name_patterns: ['^api_v1']
with_tag: true
disable_default_routes: false

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固