定制 bricre/royalmail-tracking-v2-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bricre/royalmail-tracking-v2-sdk

Composer 安装命令:

composer require bricre/royalmail-tracking-v2-sdk

包简介

Royal Mail Tracking (for Server-side app) v2 REST API SDK generated from swagger specification

README 文档

README

PHP SDK generated from RoyalMail's Swagger File

Latest Stable Version Total Downloads License codecov

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\ResponseHandler\JsonPsrResponseHandler;
use OpenAPI\Runtime\ResponseHandlerStack;
use RoyalMail\SDK\V2Tracking\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 ResponseHandlerStack([
        JsonPsrResponseHandler::setResponseTypes(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

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2021-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固