PHPackages                             yundun/yundunsdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. yundun/yundunsdk

ActiveLibrary[Testing &amp; Quality](/categories/testing)

yundun/yundunsdk
================

YUNDUN SDK

v1.0.8(6y ago)08311PHPPHP &gt;=5.6CI failing

Since Feb 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/jason-gao/YUNDUNSDK)[ Packagist](https://packagist.org/packages/yundun/yundunsdk)[ RSS](/packages/yundun-yundunsdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (10)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e4f2c706d625ebd14e1d0a4f8066ca69fbd547f50404e722b8ed5c925d79391d/68747470733a2f2f7472617669732d63692e6f72672f6a61736f6e2d67616f2f59554e44554e53444b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jason-gao/YUNDUNSDK)[![Latest Stable Version](https://camo.githubusercontent.com/49d7dc98eca6b091e4ac664dc51035ef5a98d61445b8fc27569bb6680c3527a8/68747470733a2f2f706f7365722e707567782e6f72672f79756e64756e2f79756e64756e73646b2f762f737461626c65)](https://packagist.org/packages/yundun/yundunsdk)[![Total Downloads](https://camo.githubusercontent.com/1dcdc3d74fa531f6fc2215dc219746ddf379a25149ae0bb39ea0dde85a1e54fb/68747470733a2f2f706f7365722e707567782e6f72672f79756e64756e2f79756e64756e73646b2f646f776e6c6f616473)](https://packagist.org/packages/yundun/yundunsdk)[![Latest Unstable Version](https://camo.githubusercontent.com/ffd6ac85b8690b2f6e0267ae730e3ad98961577adbeb7f08cf144cbd9ba00edb/68747470733a2f2f706f7365722e707567782e6f72672f79756e64756e2f79756e64756e73646b2f762f756e737461626c65)](https://packagist.org/packages/yundun/yundunsdk)[![License](https://camo.githubusercontent.com/c6199ed42e4b2e4143abf3a09cbc5b3c6587abeed6889a74ba4e0db2b22474e8/68747470733a2f2f706f7365722e707567782e6f72672f79756e64756e2f79756e64756e73646b2f6c6963656e7365)](https://packagist.org/packages/yundun/yundunsdk)[![Monthly Downloads](https://camo.githubusercontent.com/5f61b2460f00fec7b38eaf76e70cc2e3eb05fb32ae8f99cde13a3be2610e1ffd/68747470733a2f2f706f7365722e707567782e6f72672f79756e64756e2f79756e64756e73646b2f642f6d6f6e74686c79)](https://packagist.org/packages/yundun/yundunsdk)[![Daily Downloads](https://camo.githubusercontent.com/740b55fe85a98d5e546b80d8fd7eb149504f101041174d226c1582edf3208676/68747470733a2f2f706f7365722e707567782e6f72672f79756e64756e2f79756e64756e73646b2f642f6461696c79)](https://packagist.org/packages/yundun/yundunsdk)

YUNDUN API PHP SDK legend
=========================

[](#yundun-api-php-sdk-legend)

- 接口基地址： '';
- 接口遵循RESTful,默认请求体json,接口默认返回json
- app\_id, app\_secret 联系技术客服，先注册一个云盾的账号，用于申请绑定api身份

- 签名
    - 每次请求都签名，保证传输过程数据不被篡改
    - 客户端：sha256签名算法，将参数base64编码+app\_secret用sha256签名，每次请求带上签名
    - 服务端：拿到参数用相同的算法签名，对比签名是否正确

- 环境要求：php &gt;=5.5
- 依赖composer

\##使用步骤

1. composer require yundun/yundunsdk
2. 实例化

```
    //sdk
    require 'xx/vendor/autoload.php';
    $app_id = 'xx';
    $app_secret = 'xx';
    $client_ip = 'xx';
    $client_userAgent = '';
    $base_api_url = 'http://apiv4.yundun.cn/V4/';
    ;base_api_url = 'http://127.0.0.1/V4/'
    $host = 'apiv4.yundun.cn';
    $handler = 'guzzle'; //curl/guzzle默认guzzle,guzzle支持异步调用，curl驱动目前未实现异步
    $sdk = new YundunSDK (
        [
        'app_id'=>$app_id,
        'app_secret'=>$app_secret,
        'base_api_url' = 'http://127.0.0.1/V4/',
        'host' => 'apiv4.xx.cn',
        'client_ip'=>$client_ip,
        'client_userAgent'=>$client_userAgent,
        'handler'=> $handler,
        'syncExceptionOutputCode' => 0,
        'syncExceptionOutputMessage' =>'同步请求异常信息提示',
        'asyncExceptionOutputCode' => 0,
        'asyncExceptionOutputMessage' => '异步请求异常信息提示'
        'log' => true,  //是否记录sdk相关日志
        'logfileWin' => 'E:/sdkV4.log', //windows日志路径
        'logfileLinux' => '/tmp/sdkV4.log' //linux日志路径
        ]
    );

```

3. 调用

> format json返回json，xml返回xml

> body 支持传递json和数组

> urlParams会拼接在url后面

> 支持get/post/patch/put/delete方法

sync request
------------

[](#sync-request)

- get

```

$request = array(
    'url' => 'api/version',
    'body' => '',
    'headers' => [
        'format' => 'json',
    ],
    'timeout' => 10,
    'query' => [
        'params1' => 1,
        'params2' => 2
    ],
);
try{
    $res = $sdk->get($request);
}catch (\Exception $e){
    var_dump($e->getCode());
    var_dump($e->getMessage());
}
exit($res);

```

- post/put/patch/delete

```

$request = array(
    'url' => 'api/version',
    'body' => json_encode([
        'body1' => 1,
        'body2' => 2,
    ]),
    'headers' => [
        'format' => 'json',
    ],
    'timeout' => 10,
    'query' => [
        'params1' => 1,
        'params2' => 2
    ],
);
try{
    $res = $sdk->post($request);
}catch (\Exception $e){
    var_dump($e->getCode());
    var_dump($e->getMessage());
}
exit($res);

```

async request
-------------

[](#async-request)

- get

```

$request = array(
    'url' => 'api/version',
    'body' => '',
    'headers' => [
        'format' => 'json',
    ],
    'timeout' => 10,
    'query' => [
        'params1' => 1,
        'params2' => 2
    ],
    'options' => [
        'async' => true,
        'callback' => function($response){
            $body = $response->getBody->getContents();
            echo $body;
            exit;
        },
        'exception' => function($exception){}
    ]
);
try{
    $sdk->getAsync($request);
}catch (\Exception $e){
    var_dump($e->getCode());
    var_dump($e->getMessage());
}

```

- post/put/patch/delete

```

$request = array(
    'url' => 'api/version',
    'body' => json_encode([
        'body1' => 1,
        'body2' => 2,
    ]),
    'headers' => [
        'format' => 'json',
    ],
    'timeout' => 10,
    'query' => [
        'params1' => 1,
        'params2' => 2
    ],
    'options' => [
        'async' => true,
        'callback' => function($response){
            $body = $response->getBody->getContents();
            echo $body;
            exit;
        },
        'exception' => function($exception){}
    ]
);
try{
    $sdk->postAsync($request);
}catch (\Exception $e){
    var_dump($e->getCode());
    var_dump($e->getMessage());
}

```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~130 days

Recently: every ~64 days

Total

9

Last Release

2315d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.5

v1.0.4PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/dfe2039308a3330d27c5042b04fb30b92751dd44f57a766524d0e6819dd77cf7?d=identicon)[jason-gao](/maintainers/jason-gao)

---

Top Contributors

[![jason-gao](https://avatars.githubusercontent.com/u/9896574?v=4)](https://github.com/jason-gao "jason-gao (56 commits)")

---

Tags

composerguzzlephp-cs-fixerphpunittravis-ci

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/yundun-yundunsdk/health.svg)

```
[![Health](https://phpackages.com/badges/yundun-yundunsdk/health.svg)](https://phpackages.com/packages/yundun-yundunsdk)
```

###  Alternatives

[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[ikwattro/guzzle-stereo

Guzzle Recorder for recording Request/Responses and replay them back in a Mock

782.6k1](/packages/ikwattro-guzzle-stereo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
