zamnuts/ean-api-client
Composer 安装命令:
composer require zamnuts/ean-api-client
包简介
Expedia Affiliate Network API Client
README 文档
README
This is a comprehensive library for working with v3 r27 of the EAN API. An affiliate account is required to actually use any of this successfully (even in developer mode). Read more about it in the EAN Developer Documentation. This structured library attempts to provide precise request and response parameters for each query type. This is especially helpful when code-hinting is available via an IDE of some sort; it should speed up integration and leave out guess-work during maintenance.
Current State of This Lib
Not going to lie here... it is in need of a good inventory and audit. At the time of this writing, this has been sitting on the shelf collecting dust for a while now.
- It was at one point successfully functioning in a production environment.
- The phpdocs are mostly complete for public members.
- Most, but not all, request/response types are accounted for; one that I know of that is incomplete is
LocationInfoRequestwithin Geo Functions (just b/c the project this was intended for didn't use it), but the rest should be functional. - No unit tests exist whatsoever, oops. Written tests with stubs and fixtures would be nice, yes?
- Some of the "behind-the-scenes" methods are half baked; the original intention was for two-way request/response processing and rendering. This never came to fruition, but there are remnants, and some of them work.
- Only supports r27 of the API, while the latest at the time of this writing is v30.
Usage and Examples
See examples/*.php for hotel list search example and general usage.
To get started, you'll need an EAN API key and secret. Only one EANConfig and EANFacade is required at a time.
EANConfig is used as a model to feed the API configuration into EANFacade. EANFacade applies the general
configurations to each query request, e.g. EANFacade->query(EANAbstractQuery). Anything in EANAPIClient\Query
can be instantiated and passed into the facade's query method, at which point the response property of the
EANAbstractQuery object will contain the results. Any instance of EANAbstractQuery is stateful, so if repeat
and/or subsequent queries must be performed (especially of the same type), a new one should be instantiated, and then
passed into the same EANFacade instance's query method.
Ping Example
use zamnuts\EANAPIClient\EANFacade; use zamnuts\EANAPIClient\EANConfig; use zamnuts\EANAPIClient\Query\EANPing; // need session ID for EAN API, this can technically be anything, but this is best practice session_start(); // config for EANFacade $config = new EANConfig(); $config->apiKey = ''; // CHANGEME $config->apiSecret = ''; // CHANGEME $config->cid = 0; // CHANGEME $config->sessionId = session_id(); // this happens automatically, but just for example $config->devMode = true; // switch to "false" in prod // this is the gateway into the EAN API, all query structures are executed through this profile $ean = new EANFacade($config); // just need one of these for all queries to use $ping = new EANPing(); $ping->echo = 'Hello World'; // send this data $ean->query($ping); // due to the nature of the EAN API's ping request, // the "echo" parameter should be the same in the response as the request echo $ping->response->echo."\n"; // got this data back echo ($ping->response->echo === $ping->echo ? 'MATCH' : 'INVALID')."\n";
Will output:
Hello World
MATCH
License
BSD-3-Clause, see LICENSE file for full text. (c) 2015 Andrew Zammit zammit.andrew@gmail.com
zamnuts/ean-api-client 适用场景与选型建议
zamnuts/ean-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 131 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 10 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「client」 「ean」 「expedia」 「hotel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zamnuts/ean-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zamnuts/ean-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zamnuts/ean-api-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
GS1 parser and generator for PHP
A PSR-7 compatible library for making CRUD API endpoints
A PHP class for EAN and ISBN name lookup and validation using the API on ean-search.org
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
A library for EAN and ISBN name lookup and validation using the API on ean-search.org
统计信息
- 总下载量: 131
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-10-15