PHPackages                             llcu/us-states - 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. llcu/us-states

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

llcu/us-states
==============

A PHP package providing US states data with static method access

1.0.0(5mo ago)015MITPHPPHP &gt;=8.1

Since Dec 16Pushed 5mo agoCompare

[ Source](https://github.com/llcu/us-states)[ Packagist](https://packagist.org/packages/llcu/us-states)[ RSS](/packages/llcu-us-states/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

LLCU - US States
================

[](#llcu---us-states)

A PHP package providing US states data with static method access.

Requirements
------------

[](#requirements)

- PHP 8.3 or higher

Installation
------------

[](#installation)

```
composer require llcu/us-states
```

Usage
-----

[](#usage)

All methods are static, so no instantiation is required.

### Get All States

[](#get-all-states)

```
use LLCU\UsStates\States;

// Get all 50 US states (abbreviation => name)
$states = States::all();
// ['AL' => 'Alabama', 'AK' => 'Alaska', ...]
```

### Lookup Methods

[](#lookup-methods)

```
// Get state name by abbreviation
$name = States::getName('CA');
// 'California'

// Get abbreviation by state name
$abbr = States::getAbbreviation('California');
// 'CA'
```

### Validation

[](#validation)

```
// Check if valid state
States::isValidState('CA');      // true
States::isValidState('DC');      // false (DC is a territory)

// Check if valid state
States::isValid('CA');           // true
States::isValid('DC');           // true
States::isValid('XX');           // false
```

### Lists

[](#lists)

```
// Get all abbreviations
$abbreviations = States::abbreviations();
// ['AL', 'AK', 'AZ', ...]

// Get all names
$names = States::names();
// ['Alabama', 'Alaska', 'Arizona', ...]

// Get count
$count = States::count();
// 50
```

### Search

[](#search)

```
// Search states by partial name
$results = States::search('new');
// ['NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York']
```

### HTML Select Options

[](#html-select-options)

```
// Basic options
$options = States::asSelectOptions();

// With placeholder
$options = States::asSelectOptions(false, 'Select a state...');
// ['' => 'Select a state...', 'AL' => 'Alabama', ...]
```

### Random State

[](#random-state)

```
$random = States::random();
// ['abbreviation' => 'CA', 'name' => 'California']
```

Testing
-------

[](#testing)

This project uses [Pest](https://pestphp.com/) for testing.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance73

Regular maintenance activity

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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

153d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2abf6f3e2e31049185dbc811334b618164bd25be9c9d1314a7962f6fac810906?d=identicon)[llcu22](/maintainers/llcu22)

---

Top Contributors

[![roelmagdaleno](https://avatars.githubusercontent.com/u/3928004?v=4)](https://github.com/roelmagdaleno "roelmagdaleno (13 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (2 commits)")

---

Tags

composerpackagistphpus-states

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/llcu-us-states/health.svg)

```
[![Health](https://phpackages.com/badges/llcu-us-states/health.svg)](https://phpackages.com/packages/llcu-us-states)
```

PHPackages © 2026

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