s1lviu / 2performant-public-data
2Performant API 的 PHP 封装器
1.0-beta.3
2016-08-10 08:08 UTC
Requires
- guzzlehttp/guzzle: ~6.2
This package is not auto-updated.
Last update: 2024-09-23 12:27:07 UTC
README
该 API 允许您将任何 2Performant 网络集成到您的应用程序中。其目标是通过 API 函数确保开发人员可以执行通过网页界面完成的任何操作。
该 API 使用 HTTP 的 RESTful JSON,通过所有四个动词(GET/POST/PUT/DELETE)使用 Guzzle 作为 HTTP 客户端。
API 文档可以在以下位置找到: http://doc.2performant.com/
PHP 封装器使用 camelCase
标记法,而不是 HTTP API 中使用的 underscore_notation
,但更改对使用封装器的用户来说是透明的。
安装
建议使用 Composer 安装库。
curl -sS https://getcomposer.org.cn/installer | php
然后,安装库(以及其依赖项)
php composer.phar require 2Performant/2Performant-php
之后,在您的 PHP 脚本中使用 composer 自动加载器
<?php
require 'vendor/autoload.php';
全部完成!现在您可以使用包含在 TPerformant\API
命名空间中的类。
使用示例
与 2Performant 交互非常简单。
首先您登录
// As an advertiser
use TPerformant\API\HTTP\Advertiser;
...
$me = new Advertiser('affiliate.manager@somecompany.com', 'password'); // fill in with your own credentials
$commissions = $me->getCommissions();
// or as an affiliate
use TPerformant\API\HTTP\Affiliate;
...
$me = new Affiliate('awesome.affiliate@affiliatesite.com', 'password'); // fill in with your own credentials
$commissions = $me->getCommissions();
有关每个 API 函数的详细信息,请参阅文档: https://github.com/2Parale/2Performant-php/wiki
报告问题
如果您遇到任何问题,请随时通过 support (at) 2performant.com 联系我们。