https://github.com/kulikov-dev/ups-autocomplete
Address validation and auto-complete for PHP>=5.5
https://github.com/kulikov-dev/ups-autocomplete
address-validation api auto-complete autocomplete-address php php55 soap ups validation
Last synced: 9 months ago
JSON representation
Address validation and auto-complete for PHP>=5.5
- Host: GitHub
- URL: https://github.com/kulikov-dev/ups-autocomplete
- Owner: kulikov-dev
- License: mit
- Created: 2022-12-04T09:21:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-04T21:44:04.000Z (over 3 years ago)
- Last Synced: 2025-03-23T21:51:54.464Z (about 1 year ago)
- Topics: address-validation, api, auto-complete, autocomplete-address, php, php55, soap, ups, validation
- Language: PHP
- Homepage:
- Size: 525 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Address validation and auto-comlete using [UPS API](https://www.ups.com/tr/en/services/technology-integration/us-address-validation.page) for PHP 5.5 >=
The tool allows to work with UPS address validation tool through the SOAP, realizing operations of validation and auto-complete addresses. Contains two methods:
* validate_address - to validate an address or get a list of possible address candidates;
* get_address_field_candidates - to get a list of possible candidates for a specific field (like state, zip or address).
Before work you need to initialize the tool with your credentials:
``` php
/**
* Setup API credentials
*/
public function set_credentials()
{
$this->user_name = ''; // TODO initialize credentials from your storage.
$this->password = '';
$this->license_number = '';
}
```
After that it is ready to work. Below are sample of auto-completing a field 'address':
``` php
try {
$output = $ups_connector->get_address_field_candidates('US', $zip, $state, $city, $street, $type);
} catch (Exception $e) {
echo 'ERROR: ' . $e->getMessage();
die;
}
```