1. Go to this page and download the library: Download jstewmc/usps-address 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/ */
jstewmc / usps-address example snippets
use Jstewmc\UspsAddress\Compare;
// instantiate the compare service (ideally, from your service manager)
$compare = new Compare();
// instantiate your address
$address1 = (new MyAddress())
->setStreet1('Thirty-one Spooner Street')
->setCity('Quahog')
->setState('Rhode Island')
->setZip('12345');
// instantiate a same-but-different address
$address2 = (new MyAddress())
->setStreet1('31 Spooner St')
->setCity('Quahog')
->setState('RI')
->setZip('12345');
$compare($address1, $address2); // returns true
use Jstewmc\UspsAddress\Normalize;
// instantiate the normalize service (ideally, from your service manager)
$normalize = new Normalize();
// create an instance of your implementation
$address = (new MyAddress())
->setStreet1('Thirty-one Spooner Street')
->setCity('Quahog')
->setState('Rhode Island')
->setZip('12345');
$norm = $normalize($address);
$norm->getStreet1(); // returns "31 spooner st"
$norm->getCity(); // returns "quahog"
$norm->getState(); // returns "rhode island"
$norm->getZip(); // returns "12345"
$norm instanceof \Jstewmc\UspsAddress\Address; // returns true
use Jstewmc\UspsAddress\{Compare, Normalize};
$normalize = new Normalize();
$compare = new Compare($normalize);
use Jstewmc\UspsAddress\Address;
// Like an address, the arguments, in order, are: street 1, street 2, city, state, and zip
new Address('31 Spooner St', null, 'Quahog', 'RI', '12345');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.