PHPackages                             lyonstahl/fips - 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. lyonstahl/fips

ActiveLibrary

lyonstahl/fips
==============

Convert and operate with FIPS codes for states, counties, etc.

1.1.1(2y ago)11.4k↑605.9%Apache-2.0PHPPHP &gt;=7.3

Since Dec 7Pushed 2y agoCompare

[ Source](https://github.com/lyonstahl/fips)[ Packagist](https://packagist.org/packages/lyonstahl/fips)[ RSS](/packages/lyonstahl-fips/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

FIPS data for States and Counties of the United States
======================================================

[](#fips-data-for-states-and-counties-of-the-united-states)

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

[](#installation)

Ensure you have [composer](http://getcomposer.org) installed, then run the following command:

```
composer require lyonstahl/fips

```

That will fetch the library and its dependencies inside your vendor folder.

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

[](#requirements)

- [PHP 7.3+](https://www.php.net)
- [Composer 2.0+](https://getcomposer.org)

Usage
-----

[](#usage)

Start using either the `State` or `County` class to get the data you need.

```
$state = State::fromName('California');
echo $state->fips; // 06
echo $state->abbreviation; // CA

$counties = $state->getCounties();
echo $counties[0]->name; // Alameda
```

```
$county = County::fromFips('06037');
echo $county->name; // Los Angeles
echo $county->getState()->name; // California
```

Both classes have four common static methods:

- `fromAny((string $value)` - Get a State or County object from any identifier. Function will attempt to guess the type of identifier.
- `fromName(string $name)` - Get the State or County object from its name.
- `fromAbbr(string $abbreviation)` - Get the State object from its abbreviation.
- `fromFips(string $fips)` - Get the County object from its FIPS code.

Finally, both classes are connected, meaning you can get the State object from a County object and vice versa.

- `State::` `getCounties()` - This will fetch all the counties for the state.
- `County::` `$state` - State object is available as a property.

Running for development with Docker
-----------------------------------

[](#running-for-development-with-docker)

We have included a Dockerfile to make it easy to run the tests and debug the code. You must have Docker installed. The following commands will build the image and run the container:

1. `docker build -t lyonstahl/fips --build-arg PHP_VERSION=8 .`
2. `docker run -it --rm -v ${PWD}:/var/www/app lyonstahl/fips sh`

Debugging with XDebug in VSCode
-------------------------------

[](#debugging-with-xdebug-in-vscode)

Docker image is configured with XDebug. To debug the code with VSCode, follow these steps:

1. Install the [PHP Debug extension](https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug) in VSCode
2. Add a new PHP Debug configuration in VSCode:

    ```
    {
        "name": "XDebug Docker",
        "type": "php",
        "request": "launch",
        "port": 9003,
        "pathMappings": {
            "/var/www/app/": "${workspaceRoot}/"
        }
    }

    ```
3. `docker run -it --rm -v ${PWD}:/var/www/app --add-host host.docker.internal:host-gateway lyonstahl/fips sh`
4. Start debugging in VSCode with the 'XDebug Docker' configuration.

Testing
-------

[](#testing)

This library ships with PHPUnit for development. Composer file has been configured with some scripts, run the following command to run the tests:

```
composer test

```

###  Health Score

23

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Every ~2 days

Total

3

Last Release

833d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c62eb11675fca05cf626660aff044739bdcd80bfa3e2dab8a6afda763c219d5?d=identicon)[PAXANDDOS](/maintainers/PAXANDDOS)

---

Top Contributors

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

---

Tags

abbreviationansicountyfederal-information-processing-systemfipsisostateusazipstateunited-statesusacountyfederal information processing standardfips

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lyonstahl-fips/health.svg)

```
[![Health](https://phpackages.com/badges/lyonstahl-fips/health.svg)](https://phpackages.com/packages/lyonstahl-fips)
```

###  Alternatives

[maennchen/zipstream-php

ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.

1.9k278.3M121](/packages/maennchen-zipstream-php)[symfony/workflow

Provides tools for managing a workflow or finite state machine

62741.2M138](/packages/symfony-workflow)[spatie/laravel-model-states

State support for Eloquent models

1.3k5.9M24](/packages/spatie-laravel-model-states)[yohang/finite

A simple PHP Finite State Machine

1.3k3.5M10](/packages/yohang-finite)[alchemy/zippy

Zippy, the archive manager companion

47522.4M46](/packages/alchemy-zippy)[winzou/state-machine

A very lightweight yet powerful PHP state machine

52113.5M14](/packages/winzou-state-machine)

PHPackages © 2026

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