PHPackages                             zhuxiaojin/zx-yz-sdk - 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. [API Development](/categories/api)
4. /
5. zhuxiaojin/zx-yz-sdk

ActiveLibrary[API Development](/categories/api)

zhuxiaojin/zx-yz-sdk
====================

有赞云服务端SDK

v1.0(5y ago)013MITPHP

Since Mar 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/zhuxiaojin/zx-yz-sdk)[ Packagist](https://packagist.org/packages/zhuxiaojin/zx-yz-sdk)[ Docs](https://github.com/youzan/open-sdk-php)[ RSS](/packages/zhuxiaojin-zx-yz-sdk/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

open-sdk-php
============

[](#open-sdk-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6fd5a78a682036057d5c5ebcc9f647f83927787606816352437b54cb56f96b79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796f757a616e79756e2f6f70656e2d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/youzanyun/open-sdk)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/31df918b80d05171b57b21ffee766faf3d29115320593bb1ed826f10f6c14ce3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796f757a616e79756e2f6f70656e2d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/youzanyun/open-sdk)[![Build Status](https://camo.githubusercontent.com/a95d48549acb0c5da668d04f2c4e0d84e126906299ba50c66e84dd44f4f30755/68747470733a2f2f6170692e7472617669732d63692e6f72672f796f757a616e2f6f70656e2d73646b2d7068702e737667)](https://travis-ci.org/youzan/open-sdk-php)

YouzanYun SDK

安装
--

[](#安装)

1. 使用 `composer`

推荐使用该方式安装, 更优雅

```
$ composer require youzanyun/open-sdk
```

2. 不使用 `composer` 管理

如果你的项目不使用`composer`管理, 可以直接下载 [Release包](https://github.com/youzan/open-sdk-php/releases) 并解压, 然后在项目中添加如下代码:

```
require_once '/YOUR_SDK_PATH/youzanyun-open-sdk/open-sdk/vendor/autoload.php';
```

请注意, 需要下载的是最新的 `youzanyun-open-sdk.zip` 压缩包, 而不是 `Source code` 压缩包, `YOUR_SDK_PATH` 需更改为项目实际路径.

使用
--

[](#使用)

详情参考 [examples](examples)

### 1. 获取及刷新access\_token

[](#1-获取及刷新access_token)

#### 工具型应用 获取access\_token

[](#工具型应用-获取access_token)

```
require_once './vendor/autoload.php';

$clientId = "YOUR_CLIENT_ID";
$clientSecret = "YOUR_CLIENT_SECRET";
$resp = (new \Youzan\Open\Token($clientId, $clientSecret))->getToolAppToken('YOUR_CODE');
var_dump($resp);
```

#### 自用型应用 获取access\_token

[](#自用型应用-获取access_token)

```
require_once './vendor/autoload.php';

$clientId = "YOUR_CLIENT_ID";
$clientSecret = "YOUR_CLIENT_SECRET";

// 1. 不获取refresh_token
$resp = (new \Youzan\Open\Token($clientId, $clientSecret))->getSelfAppToken('YOUR_KDT_ID');
var_dump($resp);

// 2. 获取refresh_token
$config['refresh'] = true;  //是否获取refresh_token(可通过refresh_token刷新token)
$resp = (new \Youzan\Open\Token($clientId, $clientSecret))->getSelfAppToken('YOUR_KDT_ID', $config);
var_dump($resp);
```

#### 工具型应用及自用型应用 刷新access\_token

[](#工具型应用及自用型应用-刷新access_token)

```
require_once './vendor/autoload.php';

$clientId = "YOUR_CLIENT_ID";
$clientSecret = "YOUR_CLIENT_SECRET";
$resp = (new \Youzan\Open\Token($clientId, $clientSecret))->refreshToken('YOUR_REFRESH_TOKEN');
var_dump($resp);
```

### 2. 接口调用

[](#2-接口调用)

#### Token方式

[](#token方式)

```
require_once './vendor/autoload.php';

$accessToken = 'YOUR_TOKEN';
$client = new \Youzan\Open\Client($accessToken);

$method = 'youzan.item.get';
$apiVersion = '3.0.0';

$params = [
    'alias' => 'fa8989ad342k',
];

$response = $client->post($method, $apiVersion, $params);
var_dump($response);
```

#### 免鉴权方式 (仅支持免鉴权接口)

[](#免鉴权方式-仅支持免鉴权接口)

```
require_once './vendor/autoload.php';

$client = new \Youzan\Open\Client();

$method = 'youzan.item.get';
$apiVersion = '3.0.0';

$params = [
    'alias' => 'fa8989ad342k',
];

$response = $client->post($method, $apiVersion, $params);
var_dump($response);
```

### 3. 加密消息解密

[](#3-加密消息解密)

参考 [examples/crypto/decrypt.php](examples/crypto/decrypt.php)

License
-------

[](#license)

The MIT License. Please see [License File](LICENSE) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1896d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5ce61a827061720d827cde1189e096e91ed757c1dbb38a40151a3a4fb4dc481?d=identicon)[zhuxiaojin](/maintainers/zhuxiaojin)

---

Top Contributors

[![zhuxiaojin](https://avatars.githubusercontent.com/u/23185069?v=4)](https://github.com/zhuxiaojin "zhuxiaojin (2 commits)")

---

Tags

youzanopen-sdkyouzanyun

### Embed Badge

![Health badge](/badges/zhuxiaojin-zx-yz-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/zhuxiaojin-zx-yz-sdk/health.svg)](https://phpackages.com/packages/zhuxiaojin-zx-yz-sdk)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[youzanyun/open-sdk

有赞云服务端SDK

55140.9k4](/packages/youzanyun-open-sdk)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[xu42/open-sdk

有赞云服务端SDK

214.0k](/packages/xu42-open-sdk)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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