2017 © Pedro Peláez
 

library linkshare

A guzzle client for consuming the Linkshare API

image

nmrkt/linkshare

A guzzle client for consuming the Linkshare API

  • Thursday, September 3, 2015
  • by fosberyi
  • Repository
  • 3 Watchers
  • 4 Stars
  • 18,521 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PHP Linkshare Client

Build Status, (*1)

A Guzzle client for consuming the Linkshare API, (*2)

How it works

This library uses the OAuth Plugin: https://github.com/NMRKT/guzzle5-oauth2-subscriber to subscribe to Guzzle Client calls and ensures that your client requests have the correct "Authorization" headers., (*3)

Currently there is only a client built for the events API. Open to pull requests if anyone wants to tackle the Advanced Reports, Coupon, Product Search, etc. endpoints., (*4)

VERY IMPORTANT TO SET 'grant_type' => 'password' IN YOUR CONFIG - Otherwise the OAuth Plugin will set it as 'client_credentials' and Linkshare won't know what that means., (*5)

You can find your client_id and your client_secret here, by clicking the 'show keys' button: https://developers.rakutenmarketing.com/subscribe/site/pages/subscriptions.jag, (*6)

Usage

<?php

use Nmrkt\Linkshare\Client\Events;

$config = [
    'grant_type' => 'password',
    'username' => 'your_linkshare_username',
    'password' => 'your_linkshare_password',
    'client_id' => 'your client id',
    'client_secret' => 'your client secret',
    'scope' => 'your scope(s)', // optional
];
//initialize the client with your API config
$client =  new Events($config);
//create the oauth subscirber
$subscriber = $client->getOauth2Subscriber();
//attach the oauth subscriber to the client
$client->attachOauth2Subscriber($subscriber);

// Now you can set params using the convenience methods following the 
$client->setProcessDateStart('2014-05-30 12:00:00');
$client->setLimit(1000);
//execute the query to the API
$transactions = $client->getTransactions();

Wait, why do I have to attach the subsciber myself...?

This was implimented so that the library could be isolated and tested with mocks., (*7)

The Versions

03/09 2015

dev-master

9999999-dev

A guzzle client for consuming the Linkshare API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ian Fosbery