PHP code example of zzyc-supply / php-sdk

1. Go to this page and download the library: Download zzyc-supply/php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zzyc-supply / php-sdk example snippets

    

	/**
	 * Created by PhpStorm.
	 * User: Zzyc
	 * Date: 2022/4/17
	 * Time: 2:04 PM
	 */

	use Zzyc\Api\SupplyClient;

	$appKey = "your appkey";
	$appSecret = "your appSecret";

	try {
		$supplyClient = new SupplyClient($appKey,$appSecret);
	} catch (OssException $e) {
		printf(__FUNCTION__ . "creating supplyClient instance: FAILED\n");
		printf($e->getMessage() . "\n");
		return null;
	}

	$param = [
		'cate_id'=>3, //分类id
		'order'=>'price_asc', //排序方式: 'is_new', 新品 'price_asc', 价格升序 'price_desc', 价格降序 'rate', 评分 'sales' 销量 默认传空或不传
		'price_on'=>1, //价格区间 最低价
		'price_off'=>10, //价格区间 最高价
		'brand_id'=> '', //品牌id
		'keyword'=>'绿豆', //搜索关键字
		'page'=>1, 
		'limit'=>10
	];
	$response = json_decode($supplyClient->getApiResponse("get","/api/product/spu/lst",$param));

bash
$ composer