PHP code example of ctwillie / laravel-usps

1. Go to this page and download the library: Download ctwillie/laravel-usps 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/ */

    

ctwillie / laravel-usps example snippets


'usps' => [

    'userid' => env('USPS_USER_ID'), // string
    'verifyssl' => env('USPS_VERIFY_SSL'), // bool
    'env' => env('USPS_ENV') //string
];

use ctwillie\Usps\Address;

$address = new Address([
    'Address2' => '6406 Ivy Lane',
    'City' => 'Greenbelt',
    'State' => 'MD',
    'Zip5' => 20770
]);

$response = $address->validate();

use ctwillie\Usps\Address;

$address1 = [
    'Address2' => '6406 Ivy Lane',
    'City' => 'Greenbelt',
    'State' => 'MD',
    'Zip5' => 20770
];

$address2 = [
    'Address2' => '2185 Sandy Drive',
    'City' => 'Franklin',
    'State' => 'VA',
    'Zip5' => 32050
];

$addresses = new Address([$address1, $address2]);

$response = $addresses->validate();

$address = new Address([/* address info */ ]);

$json = $address->validate('json');
$object = $address->validate('object');
$string = $address->validate('string');