linkshare/linkshare-api

LinkShare开发者API消费的API包装器。

v1.0.9 2018-03-07 06:51 UTC

README

Latest Version on Packagist Software License Build Status SensioLabsInsight StyleCI Total Downloads

消费LinkShare开发者API的API客户端。

这是什么?

此包提供了LinkShare开发者API的客户端。

LinkShare开发者门户

实现基于PHP League的OAuth 2.0客户端库

当前实现API

  • 链接定位器(部分实现)
  • 产品搜索

用法

您可以在examples文件夹下找到如何使用API的示例。

一般来说,API客户端的创建方式如下

// Options contain the information required for
// authenticating against the API endpoints.
$options = [
    // Required: The client ID as provided by the developer's portal
    // This will vary for each API.
    'client_id'     => $clientId,

    // Required: The client secret as provided by the developer's portal
    // This will vary for each API.
    'client_secret' => $password,

    // Required: The access token as provided by the developer's portal
    // This will vary for each API.
    'access_token'  => $access_token,

    // Required: Your LinkShare Affiliate username
    'username'      => $username,

    // Required: Your LinkShare Affiliate password
    'password'      => $password,

    // Required: Your LinkShare Affiliate Site ID
    'scope'         => $scope,

    // Optional: The timeout (in seconds) before a request fails
    'timeout'       => $timeout,
];

// To create an API client, simply supply the required options as shown above
$linkLocator   = new LinkLocator($options);
$productSearch = new ProductSearch($options);