carpcai / address-parser
A PHP library covers PHP 5.4 to 7.3, split an address street to street, states, city, zipcode.
Installs: 20 394
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 2
Forks: 8
Open Issues: 0
Requires
- php: ^5.6 || ^7.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-02-25 00:07:47 UTC
README
A PHP library covers PHP 5.4 to 7.3, split an address street to street, states, city, zipcode.
Installation
This project can be installed via Composer:
$ composer require carpcai/address-parser
How to use
You can use the service as follows:
$addressObj = Parser::newParse('555 Test Drive, Testville, CA 98773');
var_dump([
'country' => $addressObj->country,
'state' => $addressObj->state,
'city' => $addressObj->city,
'addressLine1' => $addressObj->addressLine1,
'addressLine2' => $addressObj->addressLine2,
'zipcode' => $addressObj->zipcode,
]);
The output of this command will be:
array(6) {
["country"]=>
string(2) "US"
["state"]=>
string(2) "CA"
["city"]=>
string(9) "Testville"
["addressLine1"]=>
string(14) "555 Test Drive"
["addressLine2"]=>
string(0) ""
["zipcode"]=>
string(5) "98773"
}