Royal Mail Driver
This is a driver for the Royal Mail API. Check out the repository on GitHub for more information.
Installation
First, install the Royal Mail driver via the Composer package manager:
shell
composer require parceltrap/driver-royal-mail
composer require parceltrap/driver-royal-mail
Configuration
In your config/parceltrap.php
configuration file, add the following to the drivers
key:
php
'royal_mail' => [
'client_id' => env('PARCELTRAP_ROYAL_MAIL_CLIENT_ID'),
'client_secret' => env('PARCELTRAP_ROYAL_MAIL_CLIENT_SECRET'),
'accept_terms' => env('PARCELTRAP_ROYAL_MAIL_ACCEPT_TERMS', true),
],
'royal_mail' => [
'client_id' => env('PARCELTRAP_ROYAL_MAIL_CLIENT_ID'),
'client_secret' => env('PARCELTRAP_ROYAL_MAIL_CLIENT_SECRET'),
'accept_terms' => env('PARCELTRAP_ROYAL_MAIL_ACCEPT_TERMS', true),
],
You can get these details by registering for the Royal Mail API. To find out more, visit the Tracking v2 API reference. This documentation page also shows the raw Royal Mail-specific data that can be found in the returned TrackingDetails
DTO.
Usage
php
$driver = \ParcelTrap\Facades\ParcelTrap::driver('royal_mail');
$driver->find('090367574000000FE1E1B'); // ParcelTrap\DTOs\TrackingDetails
$driver = \ParcelTrap\Facades\ParcelTrap::driver('royal_mail');
$driver->find('090367574000000FE1E1B'); // ParcelTrap\DTOs\TrackingDetails