PHPackages                             kadegray/statamic-country-and-region-fieldtypes - 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. kadegray/statamic-country-and-region-fieldtypes

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

kadegray/statamic-country-and-region-fieldtypes
===============================================

Statamic Country And Region Fieldtype addon

1.2.6(1y ago)32.0kPHP

Since Mar 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kadegray/statamic-country-and-region-fieldtypes)[ Packagist](https://packagist.org/packages/kadegray/statamic-country-and-region-fieldtypes)[ RSS](/packages/kadegray-statamic-country-and-region-fieldtypes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (15)Used By (0)

Statamic Country And Region Fieldtypes
======================================

[](#statamic-country-and-region-fieldtypes)

> Statamic Country And Region Fieldtypes is an addon that is everything you need to store and display Country and Region on your site.

Features
--------

[](#features)

- Supports all Countries standardized in `ISO 3166-1`.
- Supports all Regions standardized in `ISO 3166-2` (Principle subdivisions; for example: State, Province).
- Multiselect Countries and Regions.
- Set a default Country or Region.
- On the Region fieldtype configure one or multiple Countries whose Regions will display as options.
- Locale for these Fieldtypes work in Control Panel.
- When using multi-site these fieldtypes will display the country or region in the locale of the (multi) site.

---

How to Install
--------------

[](#how-to-install)

Search 'Country and region' addon in the `Tools > Addons` section of the Statamic control panel and click **install**, or run the following command from the root of your project:

```
composer require kadegray/statamic-country-and-region-fieldtypes
```

---

How to Use
----------

[](#how-to-use)

You will notice that there are three Fieldtypes in this addon, this gives you the most control over how you would like to store country and/or region data.

- Country Fieldtype
- Region Fieldtype
- Region in Country Fieldtype

### Country Fieldtype

[](#country-fieldtype)

After adding the Country Fieldtype into your blueprint and editing an entry, the select input will display the names of countries. However, when you save the entry, the fieldtype will store the two-letter country code as the value.

[![Empty Country select on an entry](readme/images/entry_country_empty.png)](readme/images/entry_country_empty.png)

[![Typing can into Country fieldtype displaying filtered country on an entry](readme/images/entry_country_typeing_can.png)](readme/images/entry_country_typeing_can.png)

[![Country fieldtype with Canada selected on an entry](readme/images/entry_country_selected_canada.png)](readme/images/entry_country_selected_canada.png)

If you designate the field handle as "country" you can use the following code in the template to display the name of the country.

```
{{ country }}

```

If you are using multi-site, the aforementioned code will correctly display the country name in the language associated with the locale of the current site you are visiting.

### Region Fieldtype

[](#region-fieldtype)

[![Empty Region select on an entry](readme/images/entry_region_empty.png)](readme/images/entry_region_empty.png)

[![Typing br into Region fieldtype displaying filtered region on an entry](readme/images/entry_region_typing_br.png)](readme/images/entry_region_typing_br.png)

[![Region fieldtype with British Columbia selected on an entry](readme/images/entry_region_selected_bc.png)](readme/images/entry_region_selected_bc.png)

The Region Fieldtype functions similarly to the Country Fieldtype. However, in order to determine which regions of a country should be displayed, you need to configure them using the Country config.

The Country config offers two options:

1. **Manual** - This option allows you to manually select a country. [![Region Fieldtype config country manual option](readme/images/region_config_country_manual.png)](readme/images/region_config_country_manual.png)
2. **Field** - By choosing this option, you can define the handle of a Country Fieldtype that is within the same blueprint. When a country is selected in the Country Fieldtype, the Region Fieldtype will dynamically update its list of regions to correspond with the selected country. [![Region Fieldtype config country field option](readme/images/region_config_country_field.png)](readme/images/region_config_country_field.png)

### Region in Country Fieldtype

[](#region-in-country-fieldtype)

The Region in Country Fieldtype is a combination of the Country Fieldtype and the Region Fieldtype. In order to select a region, the country must be chosen first. This selection of the country dynamically updates the available options in the Region Fieldtype.

[![Region Fieldtype config country manual option](readme/images/entry_region_in_country.png)](readme/images/entry_region_in_country.png)

---

Locale configuration
--------------------

[](#locale-configuration)

### Control Panel

[](#control-panel)

In the control panel these Fieldtypes are designed to support different locales. This means that when you change the locale for the control panel, the fieldtypes will be displayed in the corresponding language.

To configure the locale of the control panel, you need to set the `locale` value in the `config/app.php` file. Don't forget to run `php artisan config:clear` afterwards to ensure the changes take effect.

### Multi site

[](#multi-site)

When using multi-site, rendering one of the Fieldtypes in an Antler `{{ region }}` will display the value in the language specific to the site's locale.

The configuration for these locales can be found in the `config/statamic/sites.php` file.

---

`countries_and_regions` tag
---------------------------

[](#countries_and_regions-tag)

Iterate over countries or regions in antlers with the `countries_and_regions` tag.

#### Countries `countries_and_regions:countries`

[](#countries-countries_and_regionscountries)

The param `default` can be used to set `selected` to true for the country that matches.

```

{{ countries_and_regions:countries default="AU" }}
    {{ isoCode }} - {{ countryName }}
{{ /countries_and_regions:countries }}

```

Example use in a register form:

```
{{ user:register_form }}
...
Country:

    {{ countries_and_regions:countries default="AU" }}

        {{ countryName }}

    {{ /countries_and_regions:countries }}

...
{{ /user:register_form }}
```

#### Regions `countries_and_regions:regions`

[](#regions-countries_and_regionsregions)

The param `country` can be used to filter for a country by code. This can also be multiple: "AU,US". The param `default` can be used to set `selected` to true for the region that matches.

```

{{ countries_and_regions:regions country="AU" default="AU-NSW" }}
    {{ isoCode }} - {{ regionName }} - {{ selected }}
{{ /countries_and_regions:regions }}

```

Example use in a register form:

```
{{ user:register_form }}
...
Region:

    {{ countries_and_regions:regions country="AU" default="AU-NSW" }}
    {{ regionName }}
    {{ /countries_and_regions:regions }}

...
{{ /user:register_form }}
```

If you have a country select above a region select please see the below subheading.

#### Endpoint: `/countries_and_regions/{countryCode}/regions`

[](#endpoint-countries_and_regionscountrycoderegions)

If you have a country select above a region select and you want the region options to update when the country is selected. Then see this example:

```

    ...options

    ...options

    async function reloadRegions() {
        const countryCode = document.getElementById("country").value;
        if (!countryCode) {
            return;
        }
        const response = await fetch(
            `/countries_and_regions/${countryCode}/regions`,
            {
                method: "POST",
                headers: {
                    "X-CSRF-Token": "{{ csrf_token }}",
                },
            }
        );
        const regions = await response.json();
        const regionElement = document.getElementById("region");
        regionElement.innerHTML = "";
        for (let region of regions) {
            let option = document.createElement("option");
            option.text = region.label;
            option.value = region.value;
            regionElement.add(option);
        }
    }

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Every ~49 days

Recently: every ~84 days

Total

13

Last Release

549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86d4262e84035b3850124b9b5324b9a880e26f190b00de4732106bcf23124130?d=identicon)[kadegray](/maintainers/kadegray)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/kadegray-statamic-country-and-region-fieldtypes/health.svg)

```
[![Health](https://phpackages.com/badges/kadegray-statamic-country-and-region-fieldtypes/health.svg)](https://phpackages.com/packages/kadegray-statamic-country-and-region-fieldtypes)
```

###  Alternatives

[benhall14/php-calendar

A simple PHP class to generate calendars.

9822.6k](/packages/benhall14-php-calendar)[timothepearce/laravel-time-series

Laravel Time Series provides an API to create and maintain projected data from you Eloquent models, and represent them as time-series.

955.4k](/packages/timothepearce-laravel-time-series)[ianm/syndication

Brings RSS and Atom feeds to Flarum

1515.9k](/packages/ianm-syndication)

PHPackages © 2026

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