PHP Classes
elePHPant
Icontem

PHP USPS API Zip Code: Get the zip code of a given location with USPS API

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-02-03 (18 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 91 This week: 14All time: 9,179 This week: 37Up
Version License PHP version Categories
usps-zipcode 1.1Free for non-comm...5PHP 5, E-Commerce, Web services
Description Author
This package is specific mainly for applications used in United States United States .

This class can Get the zip code of a given location with USPS API.

It can send a HTTP request to the USPS API Web server to request the zip code for a given physical address in the United States.

The class can parse the response and return the zip code that was found for that address.

Innovation Award
PHP Programming Innovation award nominee
January 2019
Nominee
Vote
Many applications that deal with addresses of people or companies need to know the addresses where they are located, so they can send them postal mail or parcels.

One of the details that is necessary to know about an address is the zip code.

This class can determine the zip code of a given location using the street address and city and the USPS API to find out the zip code of location in the United States.

Manuel Lemos
  Performance   Level  
Name: Jason Olson <contact>
Classes: 1 package by
Country: United States United States
Age: ???
All time rank: 4209466 in United States United States
Week rank: 32 Up5 in United States United States Up
Innovation award
Innovation award
Nominee: 1x

Details

usps-zipcode

This CLASS is designed to take advantage of the USPS API for looking up the zip code for a given physical address. There is very little examples of implementing the USPS API in PHP.

Configuration

When you instantiate the class, include the API key. See the example.php file for usage. If you don't have a valid USPS.com API, you can get one free at https://www.usps.com/business/web-tools-apis/welcome.htm

Revision History:

  • 1.0 Initial Release
  • 1.1 Moved into its own namespace, api key defined when class is instantiated, moved the sample code into it's own file.

Misc

This is also a test for me as this is the first time I've developed code in the public using git. Most code has been for private repositories. This testing will be integrated with phpStorm.

  Files folder image Files  
File Role Description
Files folder image.idea (1 file)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation
Plain text file USPS.php Class Class source

  Files folder image Files  /  .idea  
File Role Description
  Accessible without login Plain text file vcs.xml Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:91
This week:14
All time:9,179
This week:37Up