PHP code example of ddmc / core-openapi-php-sdk

1. Go to this page and download the library: Download ddmc/core-openapi-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/ */

    

ddmc / core-openapi-php-sdk example snippets


php
    composer 

php

生成CoreOpenApi\Config对象的时候需要传递一个配置数组,数组的格式如下
CoreOpenApi\Config
$config = $extParams = [
    'appKey' => '
        'alias2' => 'real api method2',
        ...
    ],
    'extParams' => [ //optional 扩展配置  通过 $this->getParamByKey($key) //来获取
        'key' => 'value',
        'key2' => 'value',
    ],
];

$confObj = CoreOpenApi\Config($config);
$appKey = $confObj->getAppKey();
$appSecret = $confObj->getAppSecret();
$methodList = $confObj->getMethodList();
$key2 = $confObj->getParamByKey('key2');
$method = $confObj->getMethodByAlias('alias');