yjgl-supply/php-sdk

PHP版本的YJGL supply API SDK

v1 2022-10-15 08:51 UTC

This package is not auto-updated.

Last update: 2024-09-29 15:48:49 UTC


README

yjgl-php-sdk

安装

  • 通过composer安装,这是推荐的方式,可以在composer.json中声明依赖,或者运行以下命令。
    $ composer require yjgl-supply/php-sdk
    
  • 直接下载并安装,SDK没有依赖其他第三方库,但需要根据composer的autoloader,增加自己的autoloader程序。

运行环境

php: >=7.0

使用方法

    use Yjgl\Api\SupplyClient;
    //appkey、appSecret 联系管理员获取
    $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 = ['page'=>1, 'limit'=>20, 'source'=>2];//请求参数
    $method = 'get';//请求方法
    $action = 'v1/index/index';//请求资源名
    $response = $supplyClient->getApiResponse($method,$action,$param);