Yii 1.1: ziplocator

Let you know the distance between two zip codes or the zipcode around a radius of X miles. Currently only for US.
8 followers

This is a rewritten version of this class I found somewhen (don't remember when or where), but now for Yii framework.

Requirements

  • Yii 1.1.6 or above
  • A DBMS like MySQL, FirebirdSQL, PostgreSQL, OracleDB or any other.

Usage

  1. Decompress the file in application.extensions
  2. Import the SQL file into your DB
  3. Enjoy
$zip = new ZipLocator();
/**
 * Calculate the distance between two zip codes
 */
echo $zip->distance('00210', '00610');
/**
 * Load the Zip codes with 10 miles radius
 */
$zips = $zip->inradius('00210', 10);
var_export($zips);

Resources

Total 2 comments

#2952 report it
robregonm at 2011/03/01 06:48am
You're right

Currently, it only works for US zip codes, however, it is planned an implementation for international zip codes.

#2949 report it
Johnatan at 2011/03/01 05:01am
Name?

Is this extension US-only? Why don't you mark it in page title/extension name?

Leave a comment

Please to leave your comment.

Create extension
Downloads