You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-2Lines changed: 44 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Laravel-Usps
2
2
3
-
This package provides a very simple wrapper for the United States Postal Service API. Currently, this package only provides address verification features, but will soon comprise all features offered by the USPS API. In the meantime, consider using [johnpaulmedina/laravel-usps](https://github.com/johnpaulmedina/laravel-usps), which is a great package.
3
+
This package provides a very simple wrapper for the United States Postal Service API. Currently, this package only provides address validation features, but will soon comprise all features offered by the USPS API. In the meantime, consider using [johnpaulmedina/laravel-usps](https://github.com/johnpaulmedina/laravel-usps), which is a great package.
4
4
5
5
### Prerequisites
6
6
@@ -42,7 +42,49 @@ In `config/services.php` add these three settings.
42
42
## Usage
43
43
44
44
The current features offered by this package are listed below.
45
-
-[Address Verification](#Address)
45
+
-[Address Validation](#Address)
46
+
47
+
48
+
## Address Validation
49
+
50
+
This `Address` class handles creating and formatting address data. Pass the constructor an associative array of address details. Array keys are case-sensitive.
51
+
Below is an example of creating an address and making an api request for validation.
52
+
53
+
```php
54
+
use ctwillie\Usps\Address;
55
+
56
+
$address = new Address([
57
+
'Address2' => '6406 Ivy Lane',
58
+
'City' => 'Greenbelt',
59
+
'State' => 'MD',
60
+
'Zip5' => 20770
61
+
]);
62
+
63
+
$response = $address->validate();
64
+
```
65
+
The USPS api limits 5 address validations per request. If you need to validate more than one address at a time, pass a multi dim array to the `Address` constructor.
0 commit comments