ebonit / centiro
Centiro SOAP webservice 的 PHP 客户端
1.0.7
2024-06-13 17:12 UTC
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2024-09-13 15:45:48 UTC
README
安装
composer require ebonit/centiro
基本用法
use \Ebonit\Centiro\Client;
$client = new Client($cntiro_username, $centiro_password);
创建新装运的示例:装运要求可在以下位置找到
Ebonit\Centiro\Method\Shipment
$shipment['Addresses'] = [$this->createAddressData($arguments)];
$shipment['Attributes'] = $this->createAttributes($pd, $format);
$shipment['Parcels'] = [$this->createParcelData($arguments)];
$shipment['OrderNumber'] = $shipmentIdentifier;
$shipment['SenderCode'] = $_ASENDIA_CUSTOMER_ID);
$shipment['ShipDate'] = date("Y-m-d", strtotime('+2 days')).'T'.date("H:i:s");
$shipment['ShipmentIdentifier'] = $shipmentIdentifier;
$shipment['Currency'] = 'EUR';
创建包裹并打印标签的示例:包裹详情可在以下位置找到
Ebonit\Centiro\Method\Parcel
$parcelDetails = [...aarray with required details...];
$response = $client->addAndPrintShipment($shipment);
保存标签数据(zpl,pdf 也是可能的)
$printFile = base_path() . "/storage/centiro_zpl/" . $response->Shipments->SequenceNumber . ".zpl";
file_put_contents($printFile, base64_decode($response->ParcelDocuments->ParcelDocument->Content));