PHPackages                             galahad/laravel-addressing - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. galahad/laravel-addressing

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

galahad/laravel-addressing
==========================

Laravel package providing addressing functionality

4.0.0(4mo ago)70343.5k↓21.3%19[1 issues](https://github.com/glhd/laravel-addressing/issues)[2 PRs](https://github.com/glhd/laravel-addressing/pulls)MITPHPPHP &gt;=7.4CI passing

Since Aug 4Pushed 4mo ago3 watchersCompare

[ Source](https://github.com/glhd/laravel-addressing)[ Packagist](https://packagist.org/packages/galahad/laravel-addressing)[ Docs](https://github.com/glhd/laravel-addressing)[ RSS](/packages/galahad-laravel-addressing/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (24)Versions (38)Used By (0)

 [ ![Tests status](https://github.com/glhd/laravel-addressing/actions/workflows/phpunit.yml/badge.svg) ](https://github.com/glhd/laravel-addressing/actions/workflows/phpunit.yml) [ ![MIT License](https://camo.githubusercontent.com/0f06b82ed6e45e8a1617f1b036eeb69a3ef802ef684ab6367c730cc1db24eaae/68747470733a2f2f706f7365722e707567782e6f72672f67616c616861642f6c61726176656c2d61646472657373696e672f6c6963656e7365) ](https://github.com/glhd/laravel-addressing/blob/main/LICENSE) [ ![Latest stable version](https://camo.githubusercontent.com/e497dc2c81461a3e003e823f8de86c7cfff7184a72accf338ca2cf0b731ee8e4/68747470733a2f2f706f7365722e707567782e6f72672f67616c616861642f6c61726176656c2d61646472657373696e672f762f737461626c65) ](https://packagist.org/packages/galahad/laravel-addressing)

Laravel Addressing
==================

[](#laravel-addressing)

Laravel Addressing is a Laravel package providing addressing functionality based on [`commerceguys/addressing`](https://github.com/commerceguys/addressing). It lets you easily work with addresses using data from CLDR and Google.

The primary focus of Laravel Addressing is:

- Access to up-to-date lists of countries, states/provinces, etc
- Easily validate address data
- Format addresses to match a specific country's rules

If you find this package useful, you should check out [Franklin](https://internachi.github.io/franklin/), our universal address input that follows the same conventions as Laravel Addressing.

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

[](#installation)

First, install the composer package:

```
composer require galahad/laravel-addressing

```

Basic Usage
-----------

[](#basic-usage)

### Country

[](#country)

```
$country = Addressing::country('US');
echo $country->getName(); // "United States"
echo $country->getCountryCode(); // "US"
```

### Administrative Area (typically states or provinces)

[](#administrative-area-typically-states-or-provinces)

```
$usa = Addressing::country('US');

echo $usa->administrativeArea('AL')->getName(); // "Alabama"
echo $usa->administrativeArea('AL')->getCode(); // "AL"

typeof $usa->administrativeAreas() // AdministrativeAreaCollection
```

Validators
----------

[](#validators)

You can use some custom validators in your Laravel app:

### Countries

[](#countries)

You can use `country`, `country_code`, or `country_name` to validate country input:

```
$this->validate($request, [
    'country' => 'required|country_code', // Must be a 2-letter ISO code, such as "US"
]);

$this->validate($request, [
    'country' => 'required|country_name', // Must be the full country name, such as "United States"
]);

$this->validate($request, [
    'country' => 'required|country', // Must be the full country name or 2-letter ISO code
]);
```

### Administrative Areas

[](#administrative-areas)

You can use `administrative_area`, `administrative_area_code`, or `administrative_area_name` to validate administrative area input:

```
// "country_field" is the form input that represents the country to validate against

$this->validate($request, [
    'state' => 'required|administrative_area_code:name_of_country_field',
]);

$this->validate($request, [
    'state' => 'required|administrative_area_name:country_field',
]);

$this->validate($request, [
    'state' => 'required|administrative_area:country_field',
]);
```

### Postal Code

[](#postal-code)

You can use `postal_code` to validate the zip/postal code:

```
$this->validate($request, [
    'postal_code' => 'required|postal_code:country_field,administrative_area_field',
]);
```

HTTP Endpoints
--------------

[](#http-endpoints)

Laravel Addressing publishes two routes by default, which can be disabled in the config file. The prefix (`/galahad/addressing`) can also be configured.

#### GET /galahad/addressing/countries

[](#get-galahadaddressingcountries)

```
{
    "label": "Countries",
    "options": {
        "AF": "Afghanistan",
        "..": "...",
        "ZW": "Zimbabwe"
    }
}
```

#### GET /galahad/addressing/countries/us/administrative-areas

[](#get-galahadaddressingcountriesusadministrative-areas)

```
{
     "label": "States",
     "country_code": "US",
     "options": {
        "AL": "Alabama",
        "**": "*******",
        "WY": "Wyoming"
     }
}
```

### Thanks!

[](#thanks)

Special thanks to [Commerce Guys](https://github.com/commerceguys) for their amazing [addressing](https://github.com/commerceguys/addressing) and [intl](https://github.com/commerceguys/intl) packages, which this project relies heavily on.

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance73

Regular maintenance activity

Popularity50

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 58.6% 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 ~110 days

Recently: every ~423 days

Total

33

Last Release

147d ago

Major Versions

0.5.1 → 1.0.x-dev2019-05-13

1.0.3 → 2.0.02020-03-10

2.2.1 → 3.0.02021-08-04

3.3.0 → 4.0.02026-03-23

PHP version history (6 changes)0.1.0PHP &gt;=5.5.9

0.5.0-beta1PHP &gt;=5.6

1.0.x-devPHP ^7.1.3

2.2.0PHP ^7.1.3|^8.0

3.0.0PHP ^7.4|^8.0

3.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21592?v=4)[Chris Morrell](/maintainers/inxilpro)[@inxilpro](https://github.com/inxilpro)

---

Top Contributors

[![jgrossi](https://avatars.githubusercontent.com/u/1175275?v=4)](https://github.com/jgrossi "jgrossi (238 commits)")[![inxilpro](https://avatars.githubusercontent.com/u/21592?v=4)](https://github.com/inxilpro "inxilpro (153 commits)")[![tormjens](https://avatars.githubusercontent.com/u/3974889?v=4)](https://github.com/tormjens "tormjens (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")[![suth](https://avatars.githubusercontent.com/u/392917?v=4)](https://github.com/suth "suth (2 commits)")[![whobutsb](https://avatars.githubusercontent.com/u/868190?v=4)](https://github.com/whobutsb "whobutsb (1 commits)")[![gjreasoner](https://avatars.githubusercontent.com/u/3363867?v=4)](https://github.com/gjreasoner "gjreasoner (1 commits)")[![hug963](https://avatars.githubusercontent.com/u/6074980?v=4)](https://github.com/hug963 "hug963 (1 commits)")[![amyuki](https://avatars.githubusercontent.com/u/6037977?v=4)](https://github.com/amyuki "amyuki (1 commits)")

---

Tags

laravelvalidationaddresscountriesaddressing

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/galahad-laravel-addressing/health.svg)

```
[![Health](https://phpackages.com/badges/galahad-laravel-addressing/health.svg)](https://phpackages.com/packages/galahad-laravel-addressing)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M227](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k31.8M161](/packages/laravel-cashier)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k12.2M128](/packages/nuwave-lighthouse)[sandermuller/laravel-fluent-validation

Fluent validation rule builders for Laravel

21428.9k6](/packages/sandermuller-laravel-fluent-validation)

PHPackages © 2026

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