承接 nmrkt/linkshare 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nmrkt/linkshare

Composer 安装命令:

composer require nmrkt/linkshare

包简介

A guzzle client for consuming the Linkshare API

README 文档

README

Build Status

A Guzzle client for consuming the Linkshare API

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.

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.

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.

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

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.

统计信息

  • 总下载量: 18.52k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-12