Read from the package's own PHP files at the commit 51149b6e63d1: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.
ApiclassRoyal Mail's Click & Drop API (a bearer API key) for orders and labels, and the Tracking API (its own client id and secret, api.royalmail.net) for where a parcel is.
4 methods · 2 constants
RoyalMailGatewayFactoryclassoptions: api_key: '%env(ROYAL_MAIL_API_KEY)%' # Click & Drop: Settings > Integrations > API tracking_client_id: null # optional: the Tracking API (developer.royalmail.net) tracking_client_secret: null rates: [...] # prices from configuration: Click & Drop quotes none
6 options
ShippingActionclassAn order in Click & Drop with its postage (the service: a Click & Drop service code, e.g. TPN01 Tracked 24, TPS01 Tracked 48, TRN01 Tracked 24 with signature; none: the account's default), then its label as PDF.
3 methods
TrackingActionclassThe Tracking API's events for a mail piece, oldest first.
3 methods
Omnibus\RoyalMail
Api class
final class Api Api.php:15
Royal Mail's Click & Drop API (a bearer API key) for orders and labels, and the Tracking API (its own client id and secret, api.royalmail.net) for where a parcel is.
const CLICK_AND_DROP = 'https://api.parcel.royalmail.com/api/v1'const TRACKING = 'https://api.royalmail.net/mailpieces/v2'
Api::__construct()
public function __construct(readonly HttpClientInterface $http, readonly string $apiKey, readonly ?string $trackingClientId = null, readonly ?string $trackingClientSecret = null, readonly int $timeout = 20)Api::call()
public function call(string $method, string $path, ?array $body = null, array $query = []): array- Returns
JSON, or ['content' => binary] for a PDF
Api::canTrack()
public function canTrack(): boolApi::track()
public function track(string $number): arrayRoyalMailGatewayFactory class
final class RoyalMailGatewayFactory extends GatewayFactory RoyalMailGatewayFactory.php:20
options: api_key: '%env(ROYAL_MAIL_API_KEY)%' # Click & Drop: Settings > Integrations > API tracking_client_id: null # optional: the Tracking API (developer.royalmail.net) tracking_client_secret: null rates: [...] # prices from configuration: Click & Drop quotes none
No pickup points: Royal Mail's are its post offices, not an API.
Options
| Option | Default | |
|---|---|---|
tracking_client_id | null | |
tracking_client_secret | null | |
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['api_key'], $c['tracking_client_id'] ?: null, $… | |
omnibus.action.shipping | new ShippingAction() | |
omnibus.action.tracking | static fn(Config $c) => $c['tracking_client_id'] && $c['tracking_client_secret'] ? new TrackingAction() : null | |
api_key | required |
Omnibus\RoyalMail\Action
ShippingAction class
final class ShippingAction implements ActionInterface, ApiAwareInterface ShippingAction.php:19
An order in Click & Drop with its postage (the service: a Click & Drop service code, e.g. TPN01 Tracked 24, TPS01 Tracked 48, TRN01 Tracked 24 with signature; none: the account's default), then its label as PDF.
ShippingAction::__construct()
public function __construct()ShippingAction::supports()
public function supports(Request $request): boolShippingAction::execute()
public function execute(Request $request): voidTrackingAction class
final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:16
The Tracking API's events for a mail piece, oldest first.
TrackingAction::__construct()
public function __construct()TrackingAction::supports()
public function supports(Request $request): boolTrackingAction::execute()
public function execute(Request $request): void