inkr / smartpost-apiclient
Itella SmartPost API客户端
1.1.2
2024-07-15 20:37 UTC
Requires
- php: ^7.3 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^9.6
README
如何安装
composer require inkr/smartpost-apiclient
如何使用
初始化客户端
$client = new SmartPost\SmartPostApiClient((new SmartPost\SmartPostApiClientConf()) ->setApiUrl('https://gateway.posti.fi/smartpost/api/ext/v1/') ->setAuthKey('apikey') );
列出地点
foreach ($client->getPlaces('EE') as $place) { print_r($place); }
创建新订单
$client->createOrders([ (new SmartPost\Model\Order\OrderCreateRequest()) ->setReference('123') ->setContent('new shipment') ->setSource((new OrderCreateRequestSource())->setCountry('EE')) ->setRecipient((new SmartPost\Model\Order\OrderCreateRequestRecipient()) ->setName('John Smith') ->setPhone('55667788') ) ->setDestination((new SmartPost\Model\Order\OrderCreateRequestDestination()) ->setCountry('EE') ->setPlaceId('01007225') ) ]);
获取跟踪信息
$client->getTracking(['barcode1', 'barcode2']);