PHPackages                             xlstudio/hupun - 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. xlstudio/hupun

ActiveLibrary[API Development](/categories/api)

xlstudio/hupun
==============

万里牛ERP开放接口的 PHP SDK

v1.1.3(2y ago)781841MITPHPPHP &gt;=5.4.0

Since Jun 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/xlstudio/hupun)[ Packagist](https://packagist.org/packages/xlstudio/hupun)[ Docs](https://github.com/xlstudio/hupun)[ RSS](/packages/xlstudio-hupun/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

HUPUN-API-PHP-SDK-20230822
==========================

[](#hupun-api-php-sdk-20230822)

用于对接万里牛 ERP 开放接口的 PHP SDK (B2C 接口 和 OPEN 接口通用)

安装方法
----

[](#安装方法)

```
composer require xlstudio/hupun
```

使用方法
----

[](#使用方法)

B2C 商品推送的接口 ( items/open )

```
use Xlstudio\Hupun\HupunClient;

$hupunClient = new HupunClient('填写你申请的 B2C 的 appKey','填写你申请的 B2C 的 appSecret');
$hupunClient->setGatewayUrl('填写万里牛的 B2C 的 API'); // 万里牛正式环境或测试环境的 B2C API 地址
$hupunClient->setHupunSdkWorkDir('./data/'); // 日志存放的工作目录

$item['shopNick'] = '你的店铺昵称'; // 万里牛 ERP 中 B2C 平台的店铺昵称( 掌柜旺旺/账号 ID )
$item['itemID'] = '商品ID';
$item['title'] = '商品标题';
$item['itemCode'] = '商品编码';
$item['price'] = 100.00; // 单价
$item['itemURL'] = '商品地址';
$item['imageURL'] = '图片地址';
$item['status'] = 1; // 0：已删除，1：在售
$item['createTime'] = time() * 1000; // 创建时间，毫秒级时间戳 (13 位毫秒级)
$item['modifyTime'] = time() * 1000; // 最新修改时间，毫秒级时间戳 (13 位毫秒级)

$item['skus'] = []; // 规格集，如果是单规格需传入 []

$items[] = $item; // 商品集

$params['items'] = json_encode($items); // 商品集 json 串

$result = $hupunClient->execute('items/open', $params, 'post');

var_dump($result);
```

OPEN 商品推送的接口 ( erp/goods/add/item ) \[ 注意：OPEN 和 B2C 的接口及密钥需要各自申请，不能混用 \]

```
use Xlstudio\Hupun\HupunClient;

$hupunClient = new HupunClient('填写你申请的 OPEN 的 appKey','填写你申请的 OPEN 的 appSecret');
$hupunClient->setGatewayUrl('填写万里牛的 OPEN 的 API'); // 万里牛正式环境或测试环境的 OPEN API 地址
$hupunClient->setHupunSdkWorkDir('./data/'); // 日志存放的工作目录

$item['article_number'] = '货号';
$item['item_name'] = '商品名称';
$item['item_code'] = '商品编码';
$item['remark'] = '商品备注';
$item['prime_price'] = 50.00; // 参考进价——如果有规格，会忽略，即使规格集中的没有传
$item['sale_price'] = 100.00; // 标准售价——如果有规格，会忽略，即使规格集中的没有传
$item['item_pic'] = '图片地址';

$params['item'] = json_encode($item); // 商品信息 json 串

$result = $hupunClient->execute('erp/goods/add/item', $params, 'post');

var_dump($result);
```

B2C 单笔查询库存的接口 ( inventories/erp/single )

```
use Xlstudio\Hupun\HupunClient;

$hupunClient = new HupunClient('填写你申请的 B2C 的 appKey','填写你申请的 B2C 的 appSecret');
$hupunClient->setGatewayUrl('填写万里牛的 B2C 的 API'); // 万里牛正式环境或测试环境的 B2C API 地址
$hupunClient->setHupunSdkWorkDir('./data/'); // 日志存放的工作目录

$params['shop_type'] = 100; // 店铺类型，B2C 平台：100
$params['shop_nick'] = '你的店铺昵称';  // 万里牛 ERP 中 B2C 平台的店铺昵称( 掌柜旺旺/账号 ID )
$params['item_id'] = '商品ID'; // 商品编号，对应商品推送中的 itemID
$params['sku_id'] = '规格ID'; // 如果商品含规格，则必填，对应商品推送的中 skuID

$result = $hupunClient->execute('inventories/erp/single', $params, 'get');

var_dump($result);
```

如果你是使用 Laravel 框架，可以参考使用：

>

使用本 SDK 过程中如有问题，请联系作者协助解决：\[ QQ: 2019809069, WECHAT: 2019809069 \]

请他喝杯咖啡

[![喝杯咖啡](buymeacoffee.png)](buymeacoffee.png)

###### *( 如遇公司没有相关技术人员，可以联系作者沟通技术外包 )*

[](#-如遇公司没有相关技术人员可以联系作者沟通技术外包-)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

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

Every ~255 days

Recently: every ~245 days

Total

7

Last Release

1042d ago

### Community

Maintainers

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

---

Top Contributors

[![Xiphin](https://avatars.githubusercontent.com/u/3348428?v=4)](https://github.com/Xiphin "Xiphin (32 commits)")

---

Tags

apierperp-php-sdkhupunopenapiphpsdkwanliniuapisdkERPhupunwanliniu

### Embed Badge

![Health badge](/badges/xlstudio-hupun/health.svg)

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

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

46784.5k5](/packages/deepseek-php-deepseek-php-client)

PHPackages © 2026

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