fgsl/swagger-docs
最新稳定版本:1.3.1
Composer 安装命令:
composer require fgsl/swagger-docs
包简介
Swagger Documentation Generator
README 文档
README
Run command:
composer require fgsl/swagger-docs
For getting Composer: https://getcomposer.org/download/
How to use
See sample below:
vendor/bin/fsd
Defaults: source directory: src/ target directory: public/.
For an alternative source directory, pass the directory name as first argument.
For an alternative target directory, pass the directory name as second argument.
So:
vendor/bin/fsd [sourceDirectory] [targetDirectory]
[sourceDirectory] and [targetDirectory] are relative to root directory of application.
Build
vendor/bin/phing
Dependency
This project depends on swagger-php.
Attributes
Use attributes for generating SWagger documentation.
Read about attributes in swagger-php attributes topic.
But maybe you can learn better by examples.
Model for API page
The following page shows the documentation generated by this component. You only need to replace [WEB ROOT ROUTE] bu the root URL of your application.
For example, for a Laminas PHP application, [WEB ROOT ROUTE] is <?=$this->url('home')?>.
<!-- HTML for static distribution bundle build --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Swagger UI</title> <link rel="stylesheet" type="text/css" href="[WEB ROOT ROUTE]swagger-ui.css" > <link rel="icon" type="image/png" href="[WEB ROOT ROUTE]>favicon-32x32.png" sizes="32x32" /> <link rel="icon" type="image/png" href="[WEB ROOT ROUTE]>favicon-16x16.png" sizes="16x16" /> <style> html { box-sizing: border-box; overflow: -moz-scrollbars-vertical; overflow-y: scroll; } *, *:before, *:after { box-sizing: inherit; } body { margin:0; background: #fafafa; } </style> </head> <body> <div id="swagger-ui"></div> <script src="[WEB ROOT ROUTE]swagger-ui-bundle.js"> </script> <script src="[WEB ROOT ROUTE]swagger-ui-standalone-preset.js"> </script> <script src="[WEB ROOT ROUTE]spec.js"> </script> <script> window.onload = function() { // Begin Swagger UI call region const ui = SwaggerUIBundle({ //url: "https://petstore.swagger.io/v2/swagger.json", spec : spec, dom_id: '#swagger-ui', deepLinking: true, presets: [ SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset ], plugins: [ SwaggerUIBundle.plugins.DownloadUrl ], layout: "StandaloneLayout" }) // End Swagger UI call region window.ui = ui } </script> </body> </html>
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-only
- 更新时间: 2025-09-19