USPS Driver
This is a driver for the USPS API. Check out the repository on GitHub for more information.
Installation
First, install the USPS driver via the Composer package manager:
shell
composer require parceltrap/driver-uspscomposer require parceltrap/driver-uspsConfiguration
In your config/parceltrap.php configuration file, add the following to the drivers key:
php
'usps' => [
'api_key' => env('PARCELTRAP_USPS_API_KEY'),
'source_id' => env('PARCELTRAP_USPS_SOURCE_ID', env('APP_NAME')),
],'usps' => [
'api_key' => env('PARCELTRAP_USPS_API_KEY'),
'source_id' => env('PARCELTRAP_USPS_SOURCE_ID', env('APP_NAME')),
],You can get these details by registering for the USPS API. To find out more, visit the Track & Confirm API reference. This documentation page also shows the raw USPS-specific data that can be found in the returned TrackingDetails DTO.
Usage
php
$driver = \ParcelTrap\Facades\ParcelTrap::driver('usps');
$driver->find('XXXXXXXXXXXXXXXXXX'); // ParcelTrap\DTOs\TrackingDetails$driver = \ParcelTrap\Facades\ParcelTrap::driver('usps');
$driver->find('XXXXXXXXXXXXXXXXXX'); // ParcelTrap\DTOs\TrackingDetails