linkshare/linkshare-api

API Wrapper for consuming LinkShare developer APIs.

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

README

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

API clients for consuming LinkShare developer APIs.

What is this?

This package provides clients for LinkShare's developer APIs.

LinkShare Developer's Portal

Implementation is based on The PHP League's OAuth 2.0 client libraries.

Currently implemented APIs:

  • Link Locator (partial implementation)
  • Product Search

Usage

You can find examples of how to use the APIs under the examples folder.

Generally though, a new API client is created in the following fashion:

// 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);