bricre/royalmail-shipping-v3-sdk
Composer 安装命令:
composer require bricre/royalmail-shipping-v3-sdk
包简介
Royal Mail Shipping V3 REST API SDK generated from swagger specification
README 文档
README
PHP SDK generated from RoyalMail's Swagger File
Usage
First you need to follow RoyalMail's instruction to reigster your App and get credentials approved
Then configure your client (you only need to do this once for the whole process), you can do this at your application's initialization stage:
<?php use GuzzleHttp\Client as Guzzle; use OpenAPI\Runtime\Client; use OpenAPI\Runtime\SimplePsrResponseHandlerStack; use RoyalMail\SDK\V3Shipping\ResponseTypes; Client::configure( new Guzzle([ 'base_uri' => 'https://api.royalmail.net', 'headers' => [ 'Accept' => 'application/json', 'X-Accept-RMG-Terms' => 'yes', 'X-IBM-Client-Id' => getenv('X-IBM-Client-Id'), 'X-IBM-Client-Secret' => getenv('X-IBM-Client-Secret'), ] ]), new SimplePsrResponseHandlerStack(new ResponseTypes()), );
Then in your actual business logic, run one of the three API methods exposed by RoyalMail
<?php use RoyalMail\SDK\V2Tracking\Api\API; use RoyalMail\SDK\V2Tracking\Model\EventsSuccessResponse; use RoyalMail\SDK\V2Tracking\Model\SignatureSuccessResponse; use RoyalMail\SDK\V2Tracking\Model\SummarySuccessResponse; $API = new API(); /** @var SummarySuccessResponse $summery */ $summary = $API->summary(['mailPieceId'=>'AA999999999GB']); /** @var EventsSuccessResponse $events */ $events = $API->events('AA999999999GB'); /** @var SignatureSuccessResponse $signature */ $signature = $API->signature('AA999999999GB');
Check APITest for more samples for how to debug
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2022-12-28