PHP code example of dsposito / address-validator

1. Go to this page and download the library: Download dsposito/address-validator 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/ */

    

dsposito / address-validator example snippets


$provider = Provider::instance(
    'usps',
    [
        'endpoint' => 'http://production.shippingapis.com/ShippingAPI.dll',
        'user_id' => 'SK297O2B7BF221',
    ]
);

$address = $provider->validate(new Address([
    'name' => 'Elon Musk',
    'street1' => '3500 Deer Creek Road',
    'city' => 'Palo Alto',
    'state' => 'CA',
    'zip' => '94304',
    'country' => 'US',
]));