haistar/shopee-php-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

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

GitHub 信息

  • Stars: 27
  • Watchers: 5
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-26