PHP code example of shipstream / fedex-rest-sdk

1. Go to this page and download the library: Download shipstream/fedex-rest-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shipstream / fedex-rest-sdk example snippets


use ShipStream\FedEx\FedEx;

$connector = new FedEx(
    clientId: 'asdf1234.....',
    clientSecret: 'qwertyuiop1234567890.....'
);

$api = $connector->postalCodeValidationV1();

$response = $api->validatePostal(
    new FullSchemaValidatePostal(
        carrierCode: 'FDXG',
        countryCode: 'US',
        stateOrProvinceCode: 'NY',
        postalCode: '10001',
        shipDate: '2024-05-20',
    )
);

// To get the raw response JSON:
$json = $response->json();

// To get the response data as a DTO:
$dto = $response->dto();