PHPackages                             qfz9527/eleme-openapi-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. qfz9527/eleme-openapi-sdk

ActiveLibrary

qfz9527/eleme-openapi-sdk
=========================

eleme-openapi-php-sdk

2.86.4(1y ago)03MITPHPPHP &gt;=8.2.0

Since Feb 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/qfz9527/eleme-openapi-php-sdk)[ Packagist](https://packagist.org/packages/qfz9527/eleme-openapi-sdk)[ RSS](/packages/qfz9527-eleme-openapi-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (95)Used By (0)

PHP SDK 接入指南 &amp; CHANGELOG
============================

[](#php-sdk-接入指南--changelog)

接入指南
----

[](#接入指南)

1. PHP version &gt;= 5.4 &amp; curl extension support
2. 通过composer安装SDK
3. 创建Config配置类，填入key，secret和sandbox参数
4. 使用sdk提供的接口进行开发调试
5. 上线前将Config中$sandbox值设为false以及填入正式环境的key和secret

### 安装

[](#安装)

#### 安装命令(20220605 变更)

[](#安装命令20220605-变更)

```
    composer require eleme-openapi-php-sdk/eleme-openapi-php-sdk
```

#### 旧安装命令(不建议使用)

[](#旧安装命令不建议使用)

```
    composer require eleme-openapi/eleme-openapi-sdk
```

### 基本用法

[](#基本用法)

```
    use ElemeOpenApi\Config\Config;
    use ElemeOpenApi\Api\ShopService;

    //实例化一个配置类
    $config = new Config($app_key, $app_secret, false);

    //使用config和token对象，实例化一个服务对象
    $shop_service = new ShopService($token, $config);

    //调用服务方法，获取资源
    $shop = shop_service->get_shop(12345);
```

### Token获取

[](#token获取)

企业应用与个人应用的token获取方法略有不同。

实际使用过程中，在token获取成功后，该token可以使用较长一段时间，需要缓存起来，请勿每次请求都重新获取token。

#### 企业应用

[](#企业应用)

```
    use ElemeOpenApi\Config\Config;
    use ElemeOpenApi\OAuth\OAuthClient;

    //实例化一个配置类
    $config = new Config($app_key, $app_secret, false);

    //使用config对象，实例化一个授权类
    $client = new OAuthClient($config);

    //根据OAuth2.0中的对应state，scope和callback_url，获取授权URL
    $auth_url = $client->get_auth_url($state, $scope, $callback_url);
```

商家打开授权URL，同意授权后，跳转到您的回调页面，并返回code

```
    //通过授权得到的code，以及正确的callback_url，获取token
    $token = $client->get_token_by_code($code, $callback_url);
```

#### 个人应用

[](#个人应用)

```
    use ElemeOpenApi\Config\Config;
    use ElemeOpenApi\OAuth\OAuthClient;

    //实例化一个配置类
    $config = new Config($app_key, $app_secret, false);

    //使用config对象，实例化一个授权类
    $client = new OAuthClient($config);

    //使用授权类获取token
    $token = $client->get_token_in_client_credentials();
```

### Demo使用方法

[](#demo使用方法)

该demo主要用来演示企业应用的授权流程和展示应用信息

1. 在开发者中心创建企业应用，记下沙箱环境店铺的账号和密码，并在沙箱环境中填入回调地址（该地址需要https）
2. 找到demo文件夹将资源拷贝到您的项目目录

```
    vendor/eleme-openapi/eleme-openapi-sdk/demo/

```

3. 在init.php中修改沙箱环境的app\_key，app\_secret，callback\_url，以及项目目录的相对路径

```
    define("ROOT_DIR", dirname(__FILE__) . "your project path");

    $app_key = "your app key";
    $app_secret = "your app secret";
    $sandbox = true;

    $scope = "all";
    $callback_url = "your callback url";
```

4. 将demo部署到服务器上
5. 打开SDK生成的授权URL，使用沙箱店铺的账号和密码进行授权，成功后调转回调接口，输出页面，展示店铺信息
6. 使用沙箱店铺的账号密码在napos客户端登陆，会发现刚刚授权的应用已安装，并能够打开应用跳转回调页，展示店铺信息

CHANGELOG:
----------

[](#changelog)

### \[1.87.0\]

[](#1870)

```
Release Date : 2024-12-05

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了斗金服务
- \[Feature\] 更新了渠道管理服务
- \[Feature\] 新增了品牌建店服务
- \[Feature\] 新增了CRM会员开放平台-权益服务
- \[Feature\] 更新了金融服务
- \[Feature\] 更新了开票服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了新消息服务
- \[Feature\] 更新了订单服务
- \[Feature\] 新增了拼团服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务
- \[Feature\] 更新了订单评论服务

### \[1.86.0\]

[](#1860)

```
Release Date : 2024-04-03

```

- \[Feature\] 更新了活动服务
- \[Feature\] 新增了渠道管理服务
- \[Feature\] 新增了生活钉接口
- \[Feature\] 更新了金融服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务
- \[Feature\] 更新了订单评论服务
- \[Feature\] 更新了商户服务

### \[1.85.0\]

[](#1850)

```
Release Date : 2024-03-01

```

- \[Feature\] 新增了斗金服务

### \[1.84.0\]

[](#1840)

```
Release Date : 2023-12-07

```

- \[Feature\] 更新了活动服务
- \[Feature\] 新增了生意参谋服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了订单服务

### \[1.83.0\]

[](#1830)

```
Release Date : 2023-11-03

```

- \[Feature\] 更新了金融服务
- \[Feature\] 更新了商品服务

### \[1.82.0\]

[](#1820)

```
Release Date : 2023-09-26

```

- \[Feature\] 更新了活动服务
- \[Feature\] 新增了开放平台用户信息查询服务
- \[Feature\] 新增了订单服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了开店服务

### \[1.81.0\]

[](#1810)

```
Release Date : 2023-09-07

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了新消息服务
- \[Feature\] 更新了商品服务

### \[1.80.0\]

[](#1800)

```
Release Date : 2023-08-02

```

- \[Feature\] 更新了商品服务
- \[Feature\] 新增了店铺分服务
- \[Feature\] 更新了商户服务

### \[1.79.0\]

[](#1790)

```
Release Date : 2023-06-30

```

- \[Feature\] 更新了金融服务
- \[Feature\] 更新了商品服务

### \[1.78.0\]

[](#1780)

```
Release Date : 2023-06-02

```

- \[Feature\] 更新了自然人商户入驻服务
- \[Feature\] 更新了开店服务

### \[1.77.0\]

[](#1770)

```
Release Date : 2023-05-10

```

- \[Feature\] 更新了活动服务
- \[Feature\] 新增了自然人商户入驻服务
- \[Feature\] 更新了消息服务
- \[Feature\] 新增了开店服务
- \[Feature\] 更新了商品服务

### \[1.76.0\]

[](#1760)

```
Release Date : 2023-03-10

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了金融服务
- \[Feature\] 更新了服务市场服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了新消息服务
- \[Feature\] 更新了商品服务
- \[Feature\] 新增了小票服务

### \[1.75.0\]

[](#1750)

```
Release Date : 2023-01-04

```

- \[Feature\] 更新了活动服务
- \[Feature\] 新增了发票服务
- \[Feature\] 更新了消息服务
- \[Feature\] 新增了新消息服务
- \[Feature\] 新增了抖音服务
- \[Feature\] 新增了开放服务
- \[Feature\] 新增了抖音商品信息补全服务
- \[Feature\] 新增了提供给dy的查询服务 ， 包括：服务数据，仲裁信息，赔付信息等
- \[Feature\] 新增了抖音风险同步服务
- \[Feature\] 更新了商品服务

### \[1.74.0\]

[](#1740)

```
Release Date : 2022-11-07

```

- \[Feature\] 新增了卡券服务

### \[1.72.0\]

[](#1720)

```
Release Date : 2022-10-10

```

- \[Feature\] 更新了金融服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务

### \[1.71.0\]

[](#1710)

```
Release Date : 2022-09-09

```

- \[Feature\] 更新了消息服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了店铺服务

### \[1.70.0\]

[](#1700)

```
Release Date : 2022-06-05

```

- \[Feature\] 更新了消息服务
- \[Feature\] 更新了订单服务

### \[1.69.0\]

[](#1690)

```
Release Date : 2022-05-08

```

- \[Feature\] 更新了金融服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务

### \[1.68.0\]

[](#1680)

```
Release Date : 2022-01-14

```

- \[Feature\] 更新了订单服务

### \[1.67.0\]

[](#1670)

```
Release Date : 2021-12-03

```

- \[Feature\] 更新了门店装修服务
- \[Feature\] 更新了金融服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了商品服务

### \[1.66.0\]

[](#1660)

```
Release Date : 2021-10-29

```

- \[Feature\] 更新了金融服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商户信用分服务
- \[Feature\] 更新了订单评论服务

### \[1.65.0\]

[](#1650)

```
Release Date : 2021-09-18

```

- \[Feature\] 更新了金融服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务

### \[1.64.0\]

[](#1640)

```
Release Date : 2021-07-08

```

- \[Feature\] 更新了商户数据服务
- \[Feature\] 更新了经营体检
- \[Feature\] 更新了金融服务
- \[Feature\] 更新了服务市场服务
- \[Feature\] 更新了消息服务
- \[Feature\] 新增了商家服务中台服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了招聘市场服务
- \[Feature\] 更新了店铺服务
- \[Feature\] 更新了订单评论服务

### \[1.63.0\]

[](#1630)

```
Release Date : 2021-01-12

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了视频服务
- \[Feature\] 更新了服务市场服务
- \[Feature\] 更新了消息服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务

### \[1.62.0\]

[](#1620)

```
Release Date : 2020-11-03

```

- \[Feature\] 更新了企业订餐商户服务
- \[Feature\] 更新了金融服务
- \[Feature\] 更新了订单服务

### \[1.61.0\]

[](#1610)

```
Release Date : 2020-04-24

```

- \[Feature\] 新增招聘市场服务、企业订单服务；订单服务更新接口

### \[1.60.0\]

[](#1600)

```
Release Date : 2020-03-30

```

- \[Feature\] 更新了商品服务

### \[1.59.0\]

[](#1590)

```
Release Date : 2019-12-27

```

- \[Feature\] 更新了金融服务

### \[1.58.0\]

[](#1580)

```
Release Date : 2019-12-23

```

- \[Feature\] 更新了店铺服务

### \[1.57.0\]

[](#1570)

```
Release Date : 2019-11-18

```

- \[Feature\] 更新了订单服务
- \[Feature\] 新增了商户信用分服务

### \[1.56.0\]

[](#1560)

```
Release Date : 2019-10-18

```

- \[Feature\] 修复requestId可能不和规范的问题

### \[1.55.0\]

[](#1550)

```
Release Date : 2019-09-26

```

- \[Feature\] 更新了活动服务

### \[1.54.0\]

[](#1540)

```
Release Date : 2019-09-01

```

- \[Feature\] 新增了经营体检

### \[1.53.0\]

[](#1530)

```
Release Date : 2019-07-19

```

- \[Feature\] 更新了服务市场服务

### \[1.52.0\]

[](#1520)

```
Release Date : 2019-07-09

```

- \[Feature\] 更新了消息服务

### \[1.51.0\]

[](#1510)

```
Release Date : 2019-06-28

```

- \[Feature\] 更新了视频服务

### \[1.50.0\]

[](#1500)

```
Release Date : 2019-05-17

```

- \[Feature\] 更新了店铺服务

### \[1.49.0\]

[](#1490)

```
Release Date : 2019-05-10

```

- \[Feature\] 更新了活动服务

### \[1.48.0\]

[](#1480)

```
Release Date : 2019-04-15

```

- \[Feature\] 更新了活动服务

### \[1.47.0\]

[](#1470)

```
Release Date : 2019-04-12

```

- \[Feature\] 更新了商户会员卡服务

### \[1.46.0\]

[](#1460)

```
Release Date : 2019-03-05

```

- \[Feature\] 更新了商品服务

### \[1.45.0\]

[](#1450)

```
Release Date : 2019-02-22

```

- \[Feature\] 餐厅入口流量服务下线接口

### \[1.44.0\]

[](#1440)

```
Release Date : 2019-01-03

```

- \[Feature\] 更新了商品服务

### \[1.43.0\]

[](#1430)

```
Release Date : 2018-12-28

```

- \[Feature\] 更新了服务市场服务
- \[Feature\] 更新了商品服务

### \[1.42.0\]

[](#1420)

```
Release Date : 2018-12-21

```

- \[Feature\] 更新了门店装修服务
- \[Feature\] 更新了订单评论服务

### \[1.41.0\]

[](#1410)

```
Release Date : 2018-12-07

```

- \[Feature\] 更新了订单服务

### \[1.40.0\]

[](#1400)

```
Release Date : 2018-11-30

```

- \[Feature\] 更新了店铺服务
- \[Feature\] requestId新增时间戳后缀

### \[1.39.0\]

[](#1390)

```
Release Date : 2018-11-15

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了店铺服务

### \[1.38.0\]

[](#1380)

```
Release Date : 2018-10-17

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了订单评论服务

### \[1.37.0\]

[](#1370)

```
Release Date : 2018-09-29

```

- \[Feature\] 新增了商户数据服务
- \[Feature\] 更新了店铺服务

### \[1.36.0\]

[](#1360)

```
Release Date : 2018-09-21

```

- \[Feature\] 更新了商户会员卡服务
- \[Feature\] 更新了门店装修服务
- \[Feature\] 新增了短信服务

### \[1.35.0\]

[](#1350)

```
Release Date : 2018-09-14

```

- \[Feature\] 更新了订单服务

### \[1.34.0\]

[](#1340)

```
Release Date : 2018-09-07

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务

### \[1.33.0\]

[](#1330)

```
Release Date : 2018-08-17

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了商户会员卡服务

### \[1.32.0\]

[](#1320)

```
Release Date : 2018-08-03

```

- \[Feature\] 新增了商户会员卡服务
- \[Feature\] 新增了CPC竞价服务
- \[Feature\] 更新了订单服务

### \[1.31.0\]

[](#1310)

```
Release Date : 2018-07-27

```

- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务

### \[1.30.0\]

[](#1300)

```
Release Date : 2018-07-13

```

- \[Feature\] 更新了订单评论服务

### \[1.29.0\]

[](#1290)

```
Release Date : 2018-07-06

```

- \[Feature\] 更新了视频服务
- \[Feature\] 更新了商品服务
- \[Feature\] 上传视频接口封装

### \[1.28.0\]

[](#1280)

```
Release Date : 2018-06-28

```

- \[Feature\] 新增了视频服务
- \[Feature\] 新增了门店装修服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务

### \[1.27.0\]

[](#1270)

```
Release Date : 2018-06-22

```

- \[Feature\] 更新了店铺服务

### \[1.26.0\]

[](#1260)

```
Release Date : 2018-06-08

```

### \[1.25.0\]

[](#1250)

```
Release Date : 2018-06-08

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了订单服务

### \[1.24.0\]

[](#1240)

```
Release Date : 2018-05-18

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了商品服务
- \[Feature\] 新增授权码换取OpenId接口

### \[1.23.0\]

[](#1230)

```
Release Date : 2018-03-23

```

- \[Feature\] 更新了活动服务
- \[Feature\] 新增了餐厅入口流量服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了店铺服务

### \[1.22.0\]

[](#1220)

```
Release Date : 2018-02-02

```

- \[Feature\] 更新了活动服务

### \[1.21.0\]

[](#1210)

```
Release Date : 2018-01-18

```

- \[Feature\] 新增了服务市场服务
- \[Feature\] 更新了订单评论服务

### \[1.20.0\]

[](#1200)

```
Release Date : 2018-01-05

```

- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务

### \[1.19.0\]

[](#1190)

```
Release Date : 2017-12-24

```

- \[Feature\] 更新了订单服务
- \[Feature\] 更新了订单评论服务

### \[1.18.0\]

[](#1180)

```
Release Date : 2017-12-01

```

- \[Feature\] 更新了金融服务
- \[Feature\] 更新了订单服务

### \[1.17.0\]

[](#1170)

```
Release Date : 2017-10-27

```

- \[Feature\] 更新了活动服务

### \[1.16.0\]

[](#1160)

```
Release Date : 2017-10-22

```

- \[Feature\] 更新了活动服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了订单评论服务

### \[1.15.0\]

[](#1150)

```
Release Date : 2017-09-01

```

### \[1.14.0\]

[](#1140)

```
Release Date : 2017-09-01

```

- \[Feature\] 新增了活动服务
- \[Feature\] 更新了订单评论服务

### \[1.13.0\]

[](#1130)

```
Release Date : 2017-08-18

```

- \[Feature\] 更新了订单服务

### \[1.12.0\]

[](#1120)

```
Release Date : 2017-08-03

```

- \[Feature\] 更新了金融服务

### \[1.11.0\]

[](#1110)

```
Release Date : 2017-07-07

```

- \[Feature\] 更新了商品服务

### \[1.10.0\]

[](#1100)

```
Release Date : 2017-07-04

```

- \[Feature\] 新增了金融服务
- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务
- \[Feature\] 更新了店铺服务

### \[1.9.0\]

[](#190)

```
Release Date : 2017-05-26

```

- \[Feature\] 更新了订单服务

### \[1.8.0\]

[](#180)

```
Release Date : 2017-05-24

```

- \[Feature\] 更新了商户服务

### \[1.7.0\]

[](#170)

```
Release Date : 2017-05-18

```

- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务

### \[1.6.1\]

[](#161)

```
Release Date : 2017-05-12

```

- \[Feature\] 更新了订单服务
- \[Feature\] 更新了商品服务
- \[Feature\] 修复了demo的Util里，convert\_to\_message的json\_decode有可能精度丢失的问题

### \[v1.5.0\]

[](#v150)

```
Release Date : 2017-5-8

```

- \[Feature\] 订单服务新增接口。
- \[Feature\] 商品服务新增接口。

### \[v1.4.0\]

[](#v140)

```
Release Date : 2017-5-5

```

- \[Feature\] 店铺服务新增接口。
- \[Feature\] 商品服务新增接口。
- \[Feature\] 新增签约服务。

### \[v1.3.0\]

[](#v130)

```
Release Date : 2017-4-25

```

- \[Feature\] 店铺服务新增接口。

### \[v1.2.0\]

[](#v120)

```
Release Date : 2017-4-21

```

- \[Feature\] 订单服务新增接口。
- \[Feature\] 商品服务新增接口。
- \[Feature\] 新增订单评论服务。

### \[v1.1.10\]

[](#v1110)

```
Release Date : 2017-4-21

```

- \[Feature\] 修复了含有数组入参时，有可能造成的签名无效的问题。

### \[v1.1.9\]

[](#v119)

```
Release Date : 2017-4-14

```

- \[Feature\] 对部分字符集的入参进行了UTF8转换，修复了中文字符的签名有可能无法计算成功的问题。

### \[v1.1.8\]

[](#v118)

```
Release Date : 2017-4-11

```

- \[BugFix\] 修复了demo的HTML文件中，图片链接失效的问题

### \[v1.1.7\]

[](#v117)

```
Release Date : 2017-4-7

```

- \[Feature\] SDK完整实现

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance41

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 94.7% 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 ~30 days

Recently: every ~70 days

Total

94

Last Release

519d ago

Major Versions

1.86.0 → 2.86.32024-12-03

1.87.0 → 2.86.42024-12-06

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

1.1.7PHP &gt;=5.4.0

2.86.3PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/605889c14b71a45f23c0853ddb6cbbb6a24243cfd7d37244ddc3739b738ee7a3?d=identicon)[qfz9527](/maintainers/qfz9527)

---

Top Contributors

[![tangyan022](https://avatars.githubusercontent.com/u/24388971?v=4)](https://github.com/tangyan022 "tangyan022 (71 commits)")[![qfz9527](https://avatars.githubusercontent.com/u/24431828?v=4)](https://github.com/qfz9527 "qfz9527 (4 commits)")

---

Tags

eleme

### Embed Badge

![Health badge](/badges/qfz9527-eleme-openapi-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/qfz9527-eleme-openapi-sdk/health.svg)](https://phpackages.com/packages/qfz9527-eleme-openapi-sdk)
```

PHPackages © 2026

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