PHPackages                             on2media/us-zip-code-to-state - 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. on2media/us-zip-code-to-state

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

on2media/us-zip-code-to-state
=============================

Maps a US ZIP code to a state

1.0.0(6y ago)353.9k↓55.4%MITPHP

Since Jul 19Pushed 4w ago1 watchersCompare

[ Source](https://github.com/on2media/us-zip-code-to-state)[ Packagist](https://packagist.org/packages/on2media/us-zip-code-to-state)[ RSS](/packages/on2media-us-zip-code-to-state/feed)WikiDiscussions master Synced 2w ago

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

US ZIP Code to State
====================

[](#us-zip-code-to-state)

Some payment providers require a state to be sent when the cardholder is based in the United States. Rather than add an additional field to our payment form we created this mapping based on data obtained from [https://simple.wikipedia.org/wiki/List\_of\_ZIP\_Code\_prefixes](https://simple.wikipedia.org/wiki/List_of_ZIP_Code_prefixes).

Usage:

```
$state = (new \On2Media\UsZipCodeToState\UsZipCodeToState())->getState('90210'); // `CA`
```

Exceptions are thrown if the ZIP code is not five numeric characters or if no match is found.

In addition to state abbreviations (AK, AL, AR, AZ, CA, CO, CT, DE, FL, GA, HI, IA, ID, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MS, MT, NC, ND, NE, NH, NJ, NM, NV, NY, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VA, VT, WA, WI, WV, WY) the following other codes are also returned:

- Armed Forces (AA, AE, AP)
- District of Columbia (DC)
- Territories (GU, PR, VI)

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance62

Regular maintenance activity

Popularity32

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

2220d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1434eb1bb61fa4f70e202499ee89e7c4677dd8d80aa0c8ad89ba454f4d6a52e4?d=identicon)[on2media](/maintainers/on2media)

---

Top Contributors

[![on2](https://avatars.githubusercontent.com/u/7304119?v=4)](https://github.com/on2 "on2 (5 commits)")

---

Tags

statezip codeon2 media

### Embed Badge

![Health badge](/badges/on2media-us-zip-code-to-state/health.svg)

```
[![Health](https://phpackages.com/badges/on2media-us-zip-code-to-state/health.svg)](https://phpackages.com/packages/on2media-us-zip-code-to-state)
```

###  Alternatives

[symfony/workflow

Provides tools for managing a workflow or finite state machine

63047.0M295](/packages/symfony-workflow)[yohang/finite

A simple PHP Finite State Machine

1.3k3.7M10](/packages/yohang-finite)[winzou/state-machine

A very lightweight yet powerful PHP state machine

52414.1M21](/packages/winzou-state-machine)[ip2location/ip2location-php

\[Official Release\] IP2Location PHP API to get location info from IPv4 and IPv6 address.

2154.3M40](/packages/ip2location-ip2location-php)[sebdesign/laravel-state-machine

Winzou State Machine service provider for Laravel

3411.4M1](/packages/sebdesign-laravel-state-machine)[dougsisk/laravel-country-state

Country &amp; state helper for Laravel.

1682.0M](/packages/dougsisk-laravel-country-state)

PHPackages © 2026

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