2017 © Pedro Peláez
 

project php-postgresql-zipcode-class

Zip Code Range and Distance Calculation Class

image

austintoddj/php-postgresql-zipcode-class

Zip Code Range and Distance Calculation Class

  • Sunday, September 3, 2017
  • by austintoddj
  • Repository
  • 1 Watchers
  • 3 Stars
  • 37 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

About Zip-Calc

Zip-Calc was created to convert a PHP class written by Quixotix in 2005 from MySQL to PostgreSQL. This class calculates the distance between U.S. zip codes and also finds all of the zip codes within a 9 given radius of a known zip code., (*1)

Database

The CREATE syntax for the database table used in the example is as follows:, (*2)

CREATE TABLE "public"."maps" (
    zip_code_id  SERIAL PRIMARY KEY,
    zip_code TEXT NOT NULL,
    city TEXT NOT NULL,
    county TEXT NOT NULL,
    state_name TEXT NOT NULL,
    state_prefix TEXT NOT NULL,
    area_code TEXT NOT NULL,
    time_zone TEXT NOT NULL,
    lat NUMERIC(10,7) NOT NULL,
    lon NUMERIC(10,7) NOT NULL
);

Installation

Install the project via Composer:, (*3)

composer create-project austintoddj/zip-calc

Step 3: PgSQL Import

Once inside your database, import the data/maps.sql file included in the project. If you need some assistance on getting up and running with a PgSQL database, find out more on Digital Ocean., (*4)

Step 4: Update the Credentials

In the example.php file, you will need to update the $connectionString., (*5)

Step 5: Run the Example

If you followed the steps up to this point correctly, you should see the following when you access example.php from a browser:, (*6)

Example Screenshot, (*7)

License

Zip-Calc is open-sourced software licensed under the MIT license., (*8)

The Versions

03/09 2017

dev-master

9999999-dev

Zip Code Range and Distance Calculation Class

  Sources   Download

MIT

by Todd Austin

php postgresql distance zipcode radius zip-code

21/03 2016

v1.0.0

1.0.0.0

Zip Code Range And Distance Calculations Using PHP And PostgreSQL.

  Sources   Download

MIT

by Todd Austin

php postgresql zipcode