Skip to content

Commit 090679b

Browse files
committed
move to composer package
1 parent 951a7a1 commit 090679b

4 files changed

Lines changed: 38 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# USPS Address Validator v2 Changelog
2+
3+
## New Features
4+
5+
* Updated to use the very latest API v3 from USPS
6+
7+
## Breaking changes
8+
9+
* The minimum required PHP version changed from PHP 5 to PHP 7.4
10+
11+
## Thanks
12+
To contributors, be it with PRs, reporting issues or supporting otherwise.
13+

composer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "reddingwebdev/usps_zip_code",
3+
"description": "This class will take a normalized USA address and return the 5 digit zip code",
4+
"minimum-stability": "stable",
5+
"license": "GPL-3.0-or-later",
6+
"authors": [
7+
{
8+
"name": "Jason Olson"
9+
}
10+
],
11+
"require": {
12+
"php": ">=7.4",
13+
"ext-curl": "*"
14+
15+
},
16+
"autoload": {
17+
"psr-4": {
18+
"RedWebDev\\usps_address_validation\\": "src"
19+
}
20+
}
21+
}

example.php renamed to demo/example.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
// example code shown below:
2323

2424
require('USPS.php');
25-
use RedWebDev\USPS;
2625

27-
$uspsZip = new USPS('Consumer Key','Consumer Secret'); // insert your api key from USPS
26+
$uspsZip = new RedWebDev\uspszipcode('Consumer Key','Consumer Secret'); // insert your api key from USPS
2827

2928
$address = '1600 Amphitheatre Parkway'; // address line is required
3029
$city = 'Mountain View';
3130
$state = 'CA'; //looking for the two character state
3231

33-
$zipcode = $uspsZip->getNormalized($address, $city, $state);
32+
$zipcode = $uspsZip->getZipCode($address, $city, $state);
3433

3534
echo "Zip Code: " . $zipcode;

USPS.php renamed to src/usps_zipcode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace RedWebDev;
2222

23-
class USPS
23+
class uspszipcode
2424
{
2525

2626
private string $key;
@@ -53,7 +53,7 @@ private function getOauthV3Token(): string
5353
return $data['access_token'];
5454
}
5555

56-
public function getNormalized($address, $city, $state): ?int
56+
public function getZipCode($address, $city, $state): ?int
5757
{
5858
$token = $this->getOauthV3Token();
5959
$authorization = "Authorization: Bearer ".$token;

0 commit comments

Comments
 (0)