PHPackages                             paxxion/craft-country-load - 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. paxxion/craft-country-load

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

paxxion/craft-country-load
==========================

Simplify the creation of country/area form dropdowns.

v1.0.0(6mo ago)018mitPHPPHP &gt;=8.2CI failing

Since Oct 21Pushed 6mo agoCompare

[ Source](https://github.com/paxxion/country-load)[ Packagist](https://packagist.org/packages/paxxion/craft-country-load)[ RSS](/packages/paxxion-craft-country-load/feed)WikiDiscussions main Synced 1mo ago

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

country-load
============

[](#country-load)

A friendly country/region selector for Craft CMS 5

What it is
----------

[](#what-it-is)

Having the country/area dropdowns is one of those things that you need in just about every site. Natively, Craft has its own database but only few countries have their regions. So, we've wrapped the [Symfony Intl](https://symfony.com/doc/current/components/intl.html) component and [L91/ISO 3166-2](https://github.com/alexander-schranz/iso-3166-2) library in a simple plugin, with its own Alpine-powered widget.

BONUS: Since we use this plugin in our own websites, and we are Italian, we also included all of Italy's *province*.

Disclaimer
----------

[](#disclaimer)

This plugin uses open-source PHP libraries to list countries and regions. The data comes from public sources we don’t control, so it might not always be perfect or up to date. Use it “as is” — we can’t take responsibility for any errors or issues that come from the data.

How to use
----------

[](#how-to-use)

`craft.countryLoad.countries(lang)`

This gives you an array of countries and country codes. By default it will use currentSite.language but you can pass an optional parameter in order to localize country names.

The result array is always split into `base` and `promoted` countries. This makes it much easier to handle on the frontend but if you don’t like it you can just merge the two arrays.

Important: *base* results are in alphabetical order, *promoted* results respect the order in which they’ve entered.

Promoted but “unallowed” countries will be ignored.

`craft.countryLoad.regions(countryCode)`

This gives you an array of regions for the provided countryCode (case-insensitive).

`craft.countryLoad.italyProvinces(region)`

Returns all the provinces for the specified Italian region. If you don't pass a `region`, you will get the complete provinces array. Note that each province has two keys, `name` and `code` since it's quite common to need both:

```
{
    name: "Bergamo",
    code: "BG"
}

```

Plugin settings
---------------

[](#plugin-settings)

On top of that Country Load gives you some nice extras:

**Limit which countries are displayed**

Do you only sell to EU? You don’t need to show 200+ countries. Select the countries you want to show in the plugin settings.

**Push specific countries to the top**

Make your primary markets easier to find.

**Ready-made widget**

We’ve included a simple country/area widget, powered by Alpine.js:

`craft.countryLoad.dropdown(options)`

widget options
--------------

[](#widget-options)

```
classes: {
	wrapper: ‘’,
	countryWrapper: ‘’,
	regionWrapper: ‘’,
	provinceWrapper: ‘’,
	label: ‘’,
	select: ‘’,
	error: ‘’,
}

```

CountryLoad is BYOS (bring your own style). At the very least, labels need to have a class with `display: block` otherwise they'll look quite wrong.

```
required: {
	country: true,
	region: true,
	province: true,
}

```

Pretty straightforward. Please note that if you set required.country to false, required.region will be ignored.

```
labels: {
	country : 'Country',
	region : 'Region',
	province : 'Province',
	chooseCountry: ‘Choose your country’,
	chooseRegion: ‘Choose your region’,
	chooseProvince: ‘Choose your province’,
}

```

Labels for fields and empty states.

```
names: {
	country: ‘country’,
	region: ‘region’,
	province: province’,
}

```

Fields names are also customizable so it's easier to integrate in your own forms.

```
enableItalyProvinces: false

```

You can optionally enable a third dropdown to let users choose their Italian province.

```
language: false

```

Specify a language for country names. If you don't, `currentSite.language` will be used.

Example
-------

[](#example)

```

	{{ craft.countryLoad.dropdown({
		language: 'it',
		enableItalyProvinces: true,
		classes: {
			label: 'block mb-1',
			select: 'w-full',
			regionWrapper: 'mt-4',
			provinceWrapper: 'mt-4'
		}
	}) }}

```

A simple Tailwind-based dropdown example with common settings. Of course, you can just use it like so:

```
{{ craft.countryLoad.dropdown }}

```

FAQ
---

[](#faq)

**Region X of country Z is not listed!**

Unfortunately, we cannot help you with that. Please refer to the included libraries mentioned above to submit your request.

**Why Italian municipalities (comuni) are not included?**

It's quite uncommon to need them and we wanted to stay practical. Also, we're still looking for a reliable (and up to date) source of information.

**I don’t like your widget!**

No problem, you have all you need to build one yourself.

**Why is Palestine included?**

Why not?

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

203d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b16b046a1a92858355d5b93b24a081eab8a0ca37b4d966f38df65ac0e1bbbe63?d=identicon)[paxxion](/maintainers/paxxion)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/paxxion-craft-country-load/health.svg)

```
[![Health](https://phpackages.com/badges/paxxion-craft-country-load/health.svg)](https://phpackages.com/packages/paxxion-craft-country-load)
```

###  Alternatives

[spicyweb/craft-neo

A Matrix-like field type with block hierarchy

395798.1k10](/packages/spicyweb-craft-neo)[verbb/vizy

A flexible visual editor field for Craft.

4348.6k](/packages/verbb-vizy)[verbb/social-poster

Automatically post entries to social media.

918.5k](/packages/verbb-social-poster)[verbb/icon-picker

A slick field to pick icons from. Supports SVGs, Sprites, Webfonts, Font Awesome and more.

16162.4k4](/packages/verbb-icon-picker)[craftcms/shopify

Shopify for Craft CMS

549.2k1](/packages/craftcms-shopify)[plenta/contao-jobs-basic-bundle

Basic Job Manager for Contao (including Google Jobs).

335.1k](/packages/plenta-contao-jobs-basic-bundle)

PHPackages © 2026

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