haistar/shopee-php-sdk
最新稳定版本:v3.1.1
Composer 安装命令:
composer require haistar/shopee-php-sdk
包简介
PHP SDK for Shopee Open API
README 文档
README
This is a Shopee PHP Client, currently supported for API V2 in ShopeeOpenPlatform
Composer Install
composer require haistar/shopee-php-sdk
Usage
$shopeeClient = new ShopApiClient();
$apiConfig = new ShopeeApiConfig();
$apiConfig->setPartnerId((int) $_ENV["SHOPEE_PARTNER_ID"]);
$apiConfig->setShopId((int) $_ENV["SHOPEE_SHOP_ID"]);
$apiConfig->setAccessToken($_ENV["SHOPEE_ACCESS_TOKEN"]);
$apiConfig->setSecretKey($_ENV["SHOPEE_SECRET_KEY"]);
$baseUrl = "https://partner.test-stable.shopeemobile.com";
$apiPath = "/api/v2/product/get_item_list";
$params = array();
$productList = $shopeeClient->httpCallGet($baseUrl, $apiPath, $params, $apiConfig);
Running Test
composer test
For running all tests
For laravel 8
Run composer require haistar/shopee-php-sdk
Then composer update
Add this to .Env
SHOPEE_PARTNER_ID={partner_id}
SHOPEE_SHOP_ID= {shop_id}
SHOPEE_ACCESS_TOKEN={access_token}
SHOPEE_SECRET_KEY={partner_key}
Add ontop of Controller
use Haistar\ShopeePhpSdk\request\shop\ShopApiClient;
use Haistar\ShopeePhpSdk\client\ShopeeApiConfig;
Try
public function index()
{
$shopeeClient = new ShopApiClient();
$apiConfig = new ShopeeApiConfig();
$apiConfig->setPartnerId((int) $_ENV["SHOPEE_PARTNER_ID"]);
$apiConfig->setShopId((int) $_ENV["SHOPEE_SHOP_ID"]);
$apiConfig->setAccessToken($_ENV["SHOPEE_ACCESS_TOKEN"]);
$apiConfig->setSecretKey($_ENV["SHOPEE_SECRET_KEY"]);
$baseUrl = "https://partner.test-stable.shopeemobile.com";
$apiPath = "/api/v2/product/get_item_list";
$params = ["offset"=>0,"item_status"=>"NORMAL","page_size" => 10,];
$productList = $shopeeClient->httpCallGet($baseUrl, $apiPath, $params, $apiConfig);
return response()->json($productList);
}
统计信息
- 总下载量: 24.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 27
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-26