pccomponentes/documentation-bundle
最新稳定版本:v1.4.4
Composer 安装命令:
composer require pccomponentes/documentation-bundle
包简介
PcComponentes Documentation Bundle
README 文档
README
The documentation bundle manages the required routes and templates in order to show documentation both in OpenApi and AsyncApi formats.
Installation
Add the pccomponentes/documentation-bundle package to your require section in the composer.json file.
$ composer require pccomponentes/documentation-bundle
Add the DocumentationBundle to your application's kernel.
<?php public function registerBundles() { $bundles = [ // ... new PcComponentes\DocumentationBundle\DocumentationBundle(), // ... ]; ... }
Depending on your installation, maybe you should add it to the bundles.php file instead.
<?php return [ // ... PcComponentes\DocumentationBundle\DocumentationBundle::class => ['all' => true], // ... ];
Usage
Configure the paths to your YAML files in your config.yml (Both keys are optional).
documentation: openapi: 'docs/openapi.yml' asyncapi: 'docs/asyncapi.yml'
Enable the paths in your routing.yml file.
documentation: resource: '@DocumentationBundle/Resources/config/routing.yaml' prefix: /docs
You can choose a prefix where the documentation will be published.
After this, you should be able to see the Swagger interface at /openapi (or /docs/openapi if you used the docs
prefix), the AsyncApi at /asyncapi, and all of your event converters at /converters.
Also, you can customize the SwaggerUI options
using the key swagger_options, and the AsyncApi ones
using asyncapi_options, for example:
documentation: openapi: 'docs/openapi.yml' asyncapi: 'docs/asyncapi.yml' swagger_options: deepLinking: true displayOperationId: true displayRequestDuration: true asyncapi_options: schemaFetchOptions: '{"method":"GET","mode":"cors"}'
In addition, you can add your custom links to the homepage using the links key, here is an example:
documentation: links: - title: 'Google' description: 'You can add some notes for each link' url: 'https://www.google.com/' - title: 'Contact PcComponentes' url: 'https://www.pccomponentes.com/soporte/contactar-con-pccomponentes'
统计信息
- 总下载量: 41.45k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-27