pifeifei / shunfeng-wms
PHP版本的顺丰云仓接口
v1.0.1
2026-05-15 07:14 UTC
Requires
- php: >=8.0
- ext-dom: *
- ext-libxml: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^6.0 | ^7.0
- illuminate/support: ^9.0|^10.0|^11.0|^12.0|^13.0
- pifeifei/easy-api: *
Requires (Dev)
- laravel/pint: ^1.2
- phpstan/phpstan: ^1.0 | ^2.1
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.2|^6|^7|^8.0
- vlucas/phpdotenv: ^5.6
This package is not auto-updated.
Last update: 2026-05-16 06:58:44 UTC
README
>本接口基于以下文档创建:
顺丰供应链科技中心企业服务平台接入技术规范
安装
composer require pifeifei/shunfeng-wms
使用
require_once __DIR__ . '/vendor/autoload.php'; // Autoload files using Composer autoload
use hVenus\SFExpressAPI\BSP\OrderService;
$testEnvPath = __DIR__.'/.env';
if (file_exists($testEnvPath)) {
$dotenv = Dotenv::createImmutable(dirname($testEnvPath));
$dotenv->load();
}
$configAll = include_once __DIR__.'/config/services.php';
$config = $configAll['sf_express']['bsp'];
$client = new \Pff\SFWarehouse\WarehouseClient($config);
// 3.1 商品接口 ITEM_SERVICE
$data = ['ItemRequest' => [
'CompanyCode' => $client->getClient()->config()->client('companycode'),
'Items' => [
'Item' => [[
'SkuNo' => 'sxmTest000001', // 商品编码
'ItemName' => '测试鲜食海参6A', // 商品名称
'Description' => '测试商品描述', // 品牌描述(别名)
'StandardDescription' => '1斤', // 物品规格描述
'IsPresent' => 'N', // 是否赠品, Y:是; N:否
'IsVirtualProduct' => 'N', // 是否虚拟产品, Y:是; N:否
// 'IsFragile' => 'N', // 是否易碎品: Y:是; N:否
'ItemClass' => '鲜食海参', // 货品类型
// 'StorageTemperature' => '5', // 存储温度: 5:零下18度以下
// 'TransportTemperature' => '5', // 运输温度
]],
],
]];
$response = $client->getClient()
->proxy('http://127.0.0.1:8888')
->setData($data)
->addDataOptions(['service' => 'ITEM_SERVICE'])
->request();
dump($response->toArray());
// 或者
$data = [[
'SkuNo' => 'sxmTest000001', // 商品编码
'ItemName' => '测试鲜食海参6A', // 商品名称
'Description' => '测试商品描述', // 品牌描述(别名)
'StandardDescription' => '1斤', // 物品规格描述
'IsPresent' => 'N', // 是否赠品, Y:是; N:否
'IsVirtualProduct' => 'N', // 是否虚拟产品, Y:是; N:否
'ItemClass' => '鲜食海参', // 货品类型
]];
$response = $client->itemService($data);
dump($response);
更多参数请参考顺丰文档。
License
MIT