PHP code example of li-bao-jia / miniprogram-ci-service-php-sdk
1. Go to this page and download the library: Download li-bao-jia/miniprogram-ci-service-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/ */
li-bao-jia / miniprogram-ci-service-php-sdk example snippets
use LiBaoJia\MiniprogramCiServicePhpSdk\Client;
use LiBaoJia\MiniprogramCiServicePhpSdk\Config;
use LiBaoJia\MiniprogramCiServicePhpSdk\Exception\ApiException;
$config = new Config(
'http://127.0.0.1:3000',
'', // token,可选
60.0, // timeout
10.0 // connect timeout
);
$client = new Client($config);
try {
$result = $client->upload([
'type' => 'miniProgram',
'appid' => 'wx1234567890',
'projectPath' => '/data/code/applet/your-project',
'privateKeyPath' => '/data/key/private.wx1234567890.key',
'version' => '1.0.0',
'desc' => 'CI auto upload',
'robot' => 1,
'threads' => 3,
]);
var_dump($result);
} catch (ApiException $e) {
// 可通过 getResponseData() 获取服务端返回数据
var_dump($e->getMessage(), $e->getResponseData());
}