kleijnweb/swagger-bundle
最新稳定版本:v4.0.0-beta2
Composer 安装命令:
composer require kleijnweb/swagger-bundle
包简介
Makes your Swagger definition into a routing and validation spec
README 文档
README
Invert your workflow (contract first) using Swagger (Open API) specs and set up a Symfony REST app with minimal config.
Aimed to be lightweight, this bundle does not depend on FOSRestBundle or Twig.
HEADS UP: You are looking at the main (4.0 BETA) development line, which is PHP 7 only. SwaggerBundle 3.x is stable, maintained, and works with PHP 5.4+.
For a working example, check out https://github.com/kleijnweb/swagger-bundle-example.
Contract First
We say your OpenAPI definition is your config, and strive towards 'minimal additional config'. At the core, SwaggerBundle does three things:
- Configure Symfony routing
- Validate input
- Coerce/transform in- and output
Usage
- Create an OpenAPI document, for example using http://editor.swagger.io/.
- Install and configure this bundle
- Create one or more controllers (as services)
Check out the User Documentation for more details.
What's new in 4.0?
SwaggerBundle 4.0 is currently in the beta stage. Much of the behavior dealing with OpenAPI documents has been moved to KleijnWeb\PhpApi\Descriptions.
Routing
Now using kleijnweb/php-api-routing-bundle with a number of small improvements.
Security Integration
Request matching, voting, OpenAPI configured RBAC. See docs.
Serialization/Hydration
Support for 3rd party serializers has been replaced by a new API Description Based (de-)hyrator. Hydrating of untyped data is expected to be stdClass|stdClass[], not a combination of arrays and associative arrays as was the <4.0 default.
The new procoess has support for JSON-Schema specifics such as default values and smart NULL/undefined handling, as well as high extensibility. This allows you to hook pretty much anything you like into the (de-)hydration process, such as loading objects to be populated with request values from a data store or preserving identity of objects that occur more than once in a request.
Testing
The dependency on SwaggerAssertions has been removed, as response validation is now facilitated by KleijnWeb\PhpApi\Descriptions and integrated into the request cycle.
Errors And Exceptions
vnd.errorsupport has been removed in favor of simpler error responses. This also gets rid of some dependencies that were unneeded for most use cases.HttpErrornow supportsAccessDeniedException.
FAQ
- Will SwaggerBundle do
x?
If x is any of these, the answer will probably stay 'no':
- Handle Form posts.
- Generate API documentation.
- Support Symfony sub-requests. You won't miss them.
- Support XML.
Symfony Compatibility
SwaggerBundle is tested against Symfony 2.8.18 and the latest release (4.x.x), at least once a week.
Notes
Go to the release page to find details about the latest release.
Contributing
Pull request are very welcome, as long as:
- All automated checks were successful
- Merge would not violate semantic versioning
- When applicable, the relevant documentation is updated
License
KleijnWeb\SwaggerBundle is made available under the terms of the LGPL, version 3.0.
kleijnweb/swagger-bundle 适用场景与选型建议
kleijnweb/swagger-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.27k 次下载、GitHub Stars 达 24, 最近一次更新时间为 2015 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「swagger」 「openapi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kleijnweb/swagger-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kleijnweb/swagger-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kleijnweb/swagger-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Swagger integration to Laravel 5
Easy Swagger endpoint using the Zend Expressive routes config
一个接口文档生成器
The following pages give you some general information on how to use our APIs.<br/>The actual API services documentation then follows further below. You can use the menu to jump between API sections.<br/><br/>This page has a built-in HTTP(S) client, so you can test the services directly from within t
OpenAPI specification generator and Swagger UI for PHP 7.2-8.4 projects (standalone and Nette Framework)
统计信息
- 总下载量: 16.27k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 20
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2015-09-06