PHPackages                             austintoddj/php-postgresql-zipcode-class - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. austintoddj/php-postgresql-zipcode-class

ActiveProject[Utility &amp; Helpers](/categories/utility)

austintoddj/php-postgresql-zipcode-class
========================================

Zip Code Range and Distance Calculation Class

v1.0.0(10y ago)10522[1 PRs](https://github.com/austintoddj/zip-calc/pulls)MITPHP

Since Mar 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/austintoddj/zip-calc)[ Packagist](https://packagist.org/packages/austintoddj/php-postgresql-zipcode-class)[ RSS](/packages/austintoddj-php-postgresql-zipcode-class/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

About Zip-Calc
--------------

[](#about-zip-calc)

Zip-Calc was created to convert a PHP class written by [Quixotix](https://github.com/Quixotix/PHP-ZipCode-Class) 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.

Database
--------

[](#database)

The `CREATE` syntax for the database table used in the example is as follows:

```
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
------------

[](#installation)

Install the project via [Composer](https://getcomposer.org):

```
composer create-project austintoddj/zip-calc
```

Step 3: PgSQL Import
--------------------

[](#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](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04).

Step 4: Update the Credentials
------------------------------

[](#step-4-update-the-credentials)

In the `example.php` file, you will need to update the `$connectionString`.

Step 5: Run the Example
-----------------------

[](#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:

[![Example Screenshot](https://camo.githubusercontent.com/fd3f578d940b7e948cbd677f989e86e9887888d99d8973955e1a08ddd159dd48/68747470733a2f2f7261772e6769746875622e636f6d2f61757374696e746f64646a2f5048502d506f737467726553514c2d5a6970436f64652d436c6173732f6d61737465722f696d616765732f6578616d706c652e706e67)](https://camo.githubusercontent.com/fd3f578d940b7e948cbd677f989e86e9887888d99d8973955e1a08ddd159dd48/68747470733a2f2f7261772e6769746875622e636f6d2f61757374696e746f64646a2f5048502d506f737467726553514c2d5a6970436f64652d436c6173732f6d61737465722f696d616765732f6578616d706c652e706e67)

License
-------

[](#license)

Zip-Calc is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3746d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8037011?v=4)[Todd Austin](/maintainers/austintoddj)[@austintoddj](https://github.com/austintoddj)

---

Top Contributors

[![austintoddj](https://avatars.githubusercontent.com/u/8037011?v=4)](https://github.com/austintoddj "austintoddj (41 commits)")

---

Tags

distancephppostgresqlradiuszip-codephppostgresqlzipcode

### Embed Badge

![Health badge](/badges/austintoddj-php-postgresql-zipcode-class/health.svg)

```
[![Health](https://phpackages.com/badges/austintoddj-php-postgresql-zipcode-class/health.svg)](https://phpackages.com/packages/austintoddj-php-postgresql-zipcode-class)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21422.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
