haistar / shopee-php-sdk
PHP SDK for Shopee Open API
Installs: 6 125
Dependents: 0
Suggesters: 0
Security: 0
Stars: 27
Watchers: 6
Forks: 14
Open Issues: 1
Requires
- guzzlehttp/guzzle: ^6.5 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^7
- vlucas/phpdotenv: ^5.3
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);
}