calderawp / edd-api-client
EDD API 的 PHP 客户端
2.0.0
2017-06-24 21:24 UTC
Requires
- php: >=7.0.0
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2024-09-08 07:02:01 UTC
README
Easy Digital Downloads API 的 PHP HTTP 客户端
安装
composer require calderawp/edd-api-client
- 要求:PHP7.0+
- 使用 Guzzle 6
用法
EDD 核心
- 创建客户端
//make a guzzle instance
$client = new GuzzleHttp\Client( [ 'base_uri' => 'https://something.com/edd-api/' ] );
$key = '5419894a576acf9e773cdcdd1a8f9613';
$token = '4198047e657734f58a18f3a4051a6af8';
//create site instance
$site = new \CalderaWP\EDD\API\Site( $client, $key, $token );
获取客户
-
页面 1
$customers = $site->customers();
-
页面 2
$customers = $site->customers(2);
-
50 个客户
$customers = $site->customers(1,50);
-
客户 ID 为 42
$customer = $site->customerr(42);
获取产品
-
页面 1
$products = $site->products();
-
页面 2
$products = $site->products(2);
-
50 个产品
$products = $site->product(1,50);
-
产品 ID 为 42
$product = $site->product(42);
获取销售
-
最近的
$sales = $site->sales();
-
按客户电子邮件销售
$sales = $site->sales('roy@roysivan.com');
-
销售 ID 为 42
$sales = $site->sale(42);
EDD 定期销售
注意:我已经提交了一些 pull 请求来实现这一功能,目前请使用我在 fork 中的 api-fix 分支。
获取订阅
$subscriptions = new \CalderaWP\EDD\API\Subscriptions( $client, $key, $token );
$page1 = $subscriptions->subscriptions();
$page2 = $subscriptions->subscriptions(2);
获取订阅
$sub = $subscriptions->subscription(42);
许可证
版权所有 2016+ CalderaWP LLC。根据 GNU GPL V2+ 许可