deniztezcan / laravel-sendcloud-shipping
Laravel 对 SendCloud 物流 API 的封装
0.3.0
2021-02-16 09:10 UTC
Requires
- guzzlehttp/guzzle: ~6.0
- illuminate/support: 5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.*.*|7.*.*|8.*.*
This package is auto-updated.
Last update: 2024-09-16 17:21:23 UTC
README
这是一个基于 picqer/sendcloud-php-client 包的 Laravel 对 SendCloud 物流 API 的封装。
安装
composer require deniztezcan/laravel-sendcloud-shipping
在 config/app.php 文件中添加 ServiceProvider 到 providers 数组
'providers' => [ //other things here DenizTezcan\SendCloud\SendCloudServiceProvider::class, ];
将 facade 添加到 facades 数组
'aliases' => [ //other things here 'SendCloud' => DenizTezcan\SendCloud\Facades\SendCloud::class, ];
最后,发布配置文件
php artisan vendor:publish --provider="DenizTezcan\SendCloud\SendCloudServiceProvider"
配置
请在 config/shipping-sendcloud.php 文件中设置您的 API: key 和 secret
用法
要创建和获取可打印的标签,可以使用以下代码。ordernumber 是可选的。
<?php use DenizTezcan\SendCloud\Entities\Customer; $customer = new Customer([ 'name' => 'John Doe', 'company_name' => 'ACME Bank', 'street_address' => 'Main St', 'street_address_nr' => '123', 'city' => 'Anytown', 'postal_code' => '12345', 'country' => 'DE', ]); $parcel = SendCloud::createSingleParcel($customer, 89, 'ORDERNO'); SendCloud::getPDFFromSingleParcel($parcel);