imbue / sendcloud-api-php
PHP版本的SendCloud API客户端库。SendCloud是一家面向电子商务的欧洲物流软件
1.2.0
2024-09-16 11:44 UTC
Requires
- php: ^7.2 || ^7.3 || ^8.2
- guzzlehttp/guzzle: ~4.0|~5.0|~6.0|~7.0
Requires (Dev)
- phpunit/phpunit: ^5.7 || ^6.5 || ^7.1 || ^10.1
README
注意:此库尚未实现SendCloud API的完整功能。欢迎提交合并请求以添加额外实现。
安装
$ composer require imbue/sendcloud-api-php
入门指南
初始化SendCloud API客户端
$sendCloud = new \Imbue\SendCloud\SendCloudApiClient(); $sendCloud->setApiAuth('gb3iogpp8uf74p92holav67ij7jmpswe', '1m9mtv4ylnd8fy0xb61ury81pt6xp3fh');
创建一个新的包裹
$parcel = $sendCloud->parcels->create([ 'parcel' => [ 'name' => 'Julie Appleseed', 'company_name' => 'SendCloud', 'address' => 'Insulindelaan 115', 'house_number' => 115, 'city' => 'Eindhoven', 'postal_code' => '5642CV', 'telephone' => '+31612345678', 'request_label' => true, 'email' => 'julie@appleseed.com', 'country' => 'NL', 'shipment' => [ 'id' => 8, ], 'weight' => '10.000', 'order_number' => '1234567890', 'insured_value' => 2000, ] ]);
为集成插入或更新(upsert)运单
$shipment = $sendCloud->integrationShipments->upsert(1346, [ 'name' => 'Julie Appleseed', 'company_name' => 'SendCloud', 'address' => 'Insulindelaan 115', 'house_number' => 115, 'city' => 'Eindhoven', 'postal_code' => '5642CV', 'telephone' => '+31612345678', 'request_label' => true, 'email' => 'julie@appleseed.com', 'country' => 'NL', 'shipment' => [ 'id' => 8, ], 'weight' => '10.000', 'order_number' => '1234567890', 'insured_value' => 2000, ]);
检索集成列表
$sendCloud->integrations->list();
检索单个包裹
$sendCloud->parcels->get($id);
合作伙伴ID
如果您是SendCloud的合作伙伴,您可以设置合作伙伴ID
。库将确保将其作为请求头添加。
$sendCloud->setPartnerId('3dd88a04-26e4-4959-af11-f5674491573e')
可用方法列表
集成
- 列表
集成运单
- 列表
- upsert(更新或创建)
发票
- 列表
- 查找
包裹
- 获取
- 列表
- 创建
- 取消
包裹状态
- 列表
寄件人地址
- 获取
- 列表
运输方式
- 获取
- 列表
标签
- 获取
- 打印
- 以PDF获取标签
用户
- 获取
路线图
- 实现所有可能的端点
- 添加PHPUnit测试
想帮助改进此库吗?
我将愉快地接受新的pull请求。