orzcc / taobao-top-client
Taobao top client(SDK) for laravel
Installs: 24 500
Dependents: 0
Suggesters: 0
Security: 0
Stars: 107
Watchers: 6
Forks: 50
Open Issues: 1
Requires
- php: >=5.4.0
- graham-campbell/manager: ^2.0|^3.0|^4.0
- illuminate/support: ~5.0|~5.1|~5.2|~5.3|~5.4|~5.5|~5.6
README
The Taobao Affiliate API has been upgraded to version 2.0, merging the "Taobao Affiliate Basic Package" into the "Taobao Affiliate Basic API".
Laravel Integration
Installation
Install the package via Composer:
composer require orzcc/taobao-top-client
Configuration
- Add the service provider to the
providers
array inconfig/app.php
:
Orzcc\TopClient\TopClientServiceProvider::class,
- Add the facade to the
aliases
array inconfig/app.php
:
'TopClient' => Orzcc\TopClient\Facades\TopClient::class,
- Publish the configuration file:
php artisan vendor:publish --provider="Orzcc\TopClient\TopClientServiceProvider"
- Set your
appid
andappsecret
in the.env
file:
TAOBAO_APP_KEY=your_app_key
TAOBAO_APP_SECRET=your_app_secret
Usage Example
use TopClient; use TopClient\request\TbkItemGetRequest; $topclient = TopClient::connection(); $req = new TbkItemGetRequest; $req->setFields("num_iid,title,pict_url,reserve_price,zk_final_price,user_type,provcity,item_url"); $req->setQ('phone'); $req->setSort("tk_total_sales"); $req->setPageNo('1'); // Note: Use string values for correct pagination $req->setPageSize('40'); $resp = $topclient->execute($req); dd($resp);
Lumen Integration
Installation
Install the package via Composer:
composer require orzcc/taobao-top-client
Configuration
- Manually copy the configuration file:
cp vendor/orzcc/taobao-top-client/config/taobaotop.php config/taobaotop.php
- Add the following to
bootstrap/app.php
:
if (!class_exists('TopClient')) { class_alias('Orzcc\TopClient\Facades\TopClient', 'TopClient'); } $app->register(Orzcc\TopClient\TopClientServiceProvider::class);
- Set your
appid
andappsecret
in the.env
file:
TAOBAO_APP_KEY=your_app_key
TAOBAO_APP_SECRET=your_app_secret
Usage Example
The usage example for Lumen is the same as for Laravel:
use TopClient; use TopClient\request\TbkItemGetRequest; $topclient = TopClient::connection(); $req = new TbkItemGetRequest; $req->setFields("num_iid,title,pict_url,reserve_price,zk_final_price,user_type,provcity,item_url"); $req->setQ('phone'); $req->setSort("tk_total_sales"); $req->setPageNo('1'); // Note: Use string values for correct pagination $req->setPageSize('40'); $resp = $topclient->execute($req); dd($resp);
Sponsor
This project is sponsored by SoPicks, a revolutionary fashion discovery platform that aggregates products from multiple online stores, offering a seamless way to find and purchase desired brands all in one place.
License
This package is open-sourced software licensed under the MIT license.