cognito / sendle
Sendle API
1.0.0
2021-08-02 07:24 UTC
Requires
- php: >=7.2
README
与Sendle API交互。目前仅用于获取报价。
安装
使用composer安装非常简单
composer require cognito/sendle
设置
在Sendle上创建一个账户,登录后转到设置 > 集成。从页面复制您的API密钥和Sendle ID。
使用方法
<?php
$sendle = new \Cognito\Sendle\Sendle('Your Sendle API ID', 'Your Sendle API Key');
// Get a quote for delivery options using known weight and box dimensions
$quote = $sendle->startQuote()
->setFromPostcode(4500)
->setFromSuburb('Strathpine')
->setToPostcode(4127)
->setToSuburb('Underwood')
->setParcelDimensions(10, 8, 22)
->setParcelWeight(2.3)
->getQuote();
// Get a quote for delivery options using known weight and approximate box dimensions from cubic weight
$quote = $sendle->startQuote()
->setFromPostcode(4500)
->setFromSuburb('Strathpine')
->setToPostcode(4127)
->setToSuburb('Underwood')
->setParcelWeight(2.3)
->setParcelCubicWeight(4)
->getQuote();
// Get a quote for delivery options using known weight and volume in litres
$quote = $sendle->startQuote()
->setFromPostcode(4500)
->setFromSuburb('Strathpine')
->setToPostcode(4127)
->setToSuburb('Underwood')
->setParcelWeight(2.3)
->setVolume(4)
->getQuote();
// Get a quote for delivery options using cubic weight
$quote = $sendle->startQuote()
->setFromPostcode(4500)
->setFromSuburb('Strathpine')
->setToPostcode(4127)
->setToSuburb('Underwood')
->setParcelCubicWeight(4)
->getQuote();