beyerz/api-adapter-bundle
Composer 安装命令:
composer require beyerz/api-adapter-bundle
包简介
Symfony bundle to act as an api connector and adapter for third party apis
README 文档
README
About
Api Adapter Bundle for Symfony2
This bundle provides a gateway and adapter pattern for connecting to thrid party apis.
Using JMSSerializer, you will simply need to provide the data class to be populated with the api response.
Installation
Composer (Recommended)
composer require beyerz/api-adapter-bundle
Application Kernel
Add BeyerzApiAdapterBundle to the registerBundles() method of your application kernel:
Due to the way that this bundle is compiled and the fact that other bundles could require it, please ensure that the bundle is the last parameter in the array.
public function registerBundles() { return array( new Beyerz\ApiAdapterBundle\BeyerzApiAdapterBundle(), ); }
Usage
Config
config.yml
beyerz_api_adapter: json: my_client: #name of your client to be used, this will be accessable through container as beyerz_api_adapter.client.YOUR_CUSTOM_NAME base_url: "first_base_url" options: - "an option" - "another option"
Files and their purpose
###Manager In the manager you would write any business logic that is related to api, but not directly connected to the api. For example, if you wanted to save a copy of every response that the api returns, you could do this here.
The manager is essentially the only class that your system should work against in order to interact with the api.
The manager should have the gateway in the constructor
###Adapter The adapters job is to translate the api response into a php class. You select the adapter based on your api response type. For rest apis it is most common to use the JsonAdapter.
###Gateway We provide base gateway classes, but it is suggested that you extend from one of our base classes and add the api functions that you intend on using.
###Response Entity A response entity, is a data class that used JMSSeriliazer definitions to translate the API response. This is the class that will be passed to the gateway request from the manager.
In the event that a class is not passed, the plain Response will be returned to the manager. Sometimes this is useful when building out the api.
#TODO #Add a sample of how it works
beyerz/api-adapter-bundle 适用场景与选型建议
beyerz/api-adapter-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.09k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「Symfony2」 「api」 「REST API」 「api adapter」 「soap api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 beyerz/api-adapter-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 beyerz/api-adapter-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 beyerz/api-adapter-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
A PSR-7 compatible library for making CRUD API endpoints
Bundle Symfony DaplosBundle
Symfony2 Barcode Generator Bundle with Twig function extension
Symfony bundle to connect AWS sns and sqs to create offline queue processing
Integrate the doctrine-translatable extension in Symfony2
统计信息
- 总下载量: 2.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-14