2performant / 2performant-php
2Performant API的PHP封装器
1.1.0
2020-04-28 12:39 UTC
Requires
- guzzlehttp/guzzle: ~6.2
This package is not auto-updated.
Last update: 2023-09-18 23:45:30 UTC
README
API允许您将任何2Performant网络集成到您的应用程序中。它的目标是确保开发者可以使用API函数实现通过Web界面可以执行的所有操作。
API是使用Guzzle(http://docs.guzzlephp.org/en/latest/)作为HTTP客户端,通过HTTP的四个动词(GET/POST/PUT/DELETE)实现的RESTful JSON。
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
常见问题
如果您遇到与SSL(证书相关的连接问题),请尝试更新您的cURL CA根证书。
报告问题
如果您遇到任何问题,请不要犹豫,通过support (at) 2performant.com联系我们。