PHPackages                             lwwcas/laravel-countries - 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. [Database &amp; ORM](/categories/database)
4. /
5. lwwcas/laravel-countries

ActiveLibrary[Database &amp; ORM](/categories/database)

lwwcas/laravel-countries
========================

A comprehensive package for managing country data in Laravel applications, including multilingual support, geographic coordinates, and detailed metadata for seamless integration with Laravel.

4.13.5(1mo ago)13178.5k↓68.4%39[3 issues](https://github.com/lwwcas/laravel-countries/issues)MITPHPPHP ^8.2|^8.3CI passing

Since Nov 20Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/lwwcas/laravel-countries)[ Packagist](https://packagist.org/packages/lwwcas/laravel-countries)[ Docs](https://lwwcas.github.io/laravel-countries/)[ RSS](/packages/lwwcas-laravel-countries/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (20)Versions (27)Used By (0)

 [![Laravel Countries — Eloquent country database package for Laravel with ISO codes, flags, GeoJSON and translations](./docs/assets/hero-map.webp)](./docs/assets/hero-map.webp)

Laravel Countries
=================

[](#laravel-countries)

**The Eloquent-first country database for Laravel — every ISO code, flag, GeoJSON border and translation, one `Country::` call away.**

 [![Latest release](https://camo.githubusercontent.com/ef14cca0eaae02593371608130512a7793638858a332ee7039402f83c41261ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c77776361732f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d73717561726526636f6c6f723d253233666636663330)](https://github.com/lwwcas/laravel-countries/releases) [![Tests](https://camo.githubusercontent.com/14e78dd498685e00afc1f327f3acbd850277db1712d3649a17e1dafe65f1ab4c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c77776361732f6c61726176656c2d636f756e74726965732f63692e796d6c3f7374796c653d666c61742d737175617265266c6162656c3d746573747326636f6c6f723d253233666636663330)](https://github.com/lwwcas/laravel-countries/actions/workflows/ci.yml) [![PHP version](https://camo.githubusercontent.com/fd571fc0894dcbeee5b74e88e018afd8a46b71f9ed631fe936517ed4a49fc4a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c77776361732f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d73717561726526636f6c6f723d253233666636663330)](https://packagist.org/packages/lwwcas/laravel-countries) [![Total downloads](https://camo.githubusercontent.com/054ccb15e9ea34be5616226b945749e4cd7f14513ed4422b1b2c373a54576fb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c77776361732f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d73717561726526636f6c6f723d253233666636663330)](https://packagist.org/packages/lwwcas/laravel-countries) [![Stars](https://camo.githubusercontent.com/8ffa2f8a16a74e1c57f639f46086dd2adb671f60b91d6d86505424c27649de4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6c77776361732f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d73717561726526636f6c6f723d253233666636663330)](https://packagist.org/packages/lwwcas/laravel-countries) [![Contributors](https://camo.githubusercontent.com/4488712b33ebf41e5ef1dd4653f38eeb63d0722b48b1702afe67e568ff197d7a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f6c77776361732f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d73717561726526636f6c6f723d253233666636663330)](https://github.com/lwwcas/laravel-countries/graphs/contributors) [![Last commit](https://camo.githubusercontent.com/935af741e7801b25ede273fb42fb5e4a10e45bda7e2fd3ebd4e624077bd980b3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f6c77776361732f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d73717561726526636f6c6f723d253233666636663330)](https://github.com/lwwcas/laravel-countries/commits/master) [![License](https://camo.githubusercontent.com/6c360ca5d532553eca4b084563143b5a206e7dad6d7bbe48a0b5e1d1da868359/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c77776361732f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d73717561726526636f6c6f723d253233666636663330)](LICENSE.md)

📚 [**Full documentation**](https://lwwcas.github.io/laravel-countries/) — this README is just the quick-start version

---

**Laravel Countries** is an Eloquent-first package that models the entire world as native Laravel relationships: **ISO 3166 codes** (Alpha-2, Alpha-3, numeric), **international phone codes**, **currencies**, **national flags** (SVG, emoji, HEX/RGB colors), **GeoJSON borders**, **geographic coordinates**, **demographics**, **GDP**, **independence dates** and **region hierarchies** — all translated into **9 languages** and seeded straight into *your own* database.

No external APIs. No JSON files to fetch, parse and cache yourself. No stale array copy-pasted from a gist. Install the package, run one Artisan command, and countries behave like any other Eloquent model in your app — queryable, relatable, cacheable, testable.

> ### ⭐ Enjoying this package?
>
> [](#-enjoying-this-package)
>
> If Laravel Countries saved you some time, consider leaving a star on the repo. It's free, takes two seconds, and it's the main way other developers find this project.
>
> **[👉 Star Laravel Countries on GitHub](https://github.com/lwwcas/laravel-countries)**

### On this page

[](#on-this-page)

[Why Laravel Countries?](#-why-laravel-countries) • [Features](#-features) • [Data Model](#-data-model) • [Available Languages](#-available-languages) • [Getting Started](#-getting-started) • [Usage](#-usage--query-examples) • [Testing](#-testing) • [Contributing](#-contributing)

🤔 Why Laravel Countries?
------------------------

[](#-why-laravel-countries)

Most "country list" packages for PHP give you a static array or a JSON file with a name and a two-letter code — fine for a dropdown, useless for anything real.

Laravel Countries is built for applications that actually **do something** with country data:

- **It's a real Eloquent model, not a helper function.** `Country::whereIso('BR')->first()` behaves like any other model — relationships, scopes, eager loading, caching, all included.
- **It lives in your database, not in a vendor JSON file.** Link a `country_id` foreign key to `users`, `addresses`, `orders` — whatever your app needs — with a normal Eloquent relationship.
- **It's translated, not just in English.** Country and region names ship pre-translated in 9 languages, reviewed by native-speaking contributors — not machine-translated on the fly.
- **It's geographic, not just alphabetical.** GeoJSON borders and coordinates mean you can actually draw a map, not just print a list.
- **It's tested.** CI-checked against Laravel 11, 12 and 13 with a full Pest suite — not a "works on my machine" side project.
- **It only takes up the space you actually need.** Install just the languages your app uses — add or drop languages later without touching the rest of your data, so your database never carries translations you'll never query.

✨ Features
----------

[](#-features)

- 🗄️ **Eloquent-native country model** — `Country::` behaves like any other Laravel model: scopes, relationships, eager loading
- 🌐 **ISO 3166 codes** — Alpha-2, Alpha-3 and numeric, all queryable (`whereIso`, `whereIsoAlpha3`, `whereIsoNumeric`)
- ☎️ **International phone codes** — validate and query by dialing code (`wherePhoneCode`)
- 💱 **Currency data** — query countries by currency
- 🏳️ **Flags in 3 formats** — SVG, emoji, and flag colors in HEX/RGB
- 🗺️ **GeoJSON borders + coordinates** — precise geographic data, ready for maps
- 📊 **Demographics &amp; economics** — population, area (km²), GDP
- 🕊️ **Independence dates &amp; bordering countries**
- 🌍 **Region hierarchy** — continents and regions, translated too
- 🗣️ **9 languages built-in** — no separate i18n package needed (see table below)
- 🧩 **Install only the languages you need** — pick them at install time, then add or remove languages whenever you want, keeping your database lean instead of seeding all 9 by default
- ⚡ **One Artisan command** to install and seed everything, idempotent and CI-safe
- ✅ **Tested with Pest**, CI-checked against Laravel 11, 12, and 13
- 🚫 **Zero external API calls** — everything is seeded once, queried locally, forever

🗺️ Data Model
-------------

[](#️-data-model)

A quick look at what's on the `Country` model (full reference in the [Method Listing docs](https://lwwcas.github.io/laravel-countries/country/method-listing.html)):

CategoryFields / capabilities**Identity**ISO Alpha-2, ISO Alpha-3, ISO numeric, slug, UID, official name**Geography**Latitude/longitude, GeoJSON borders, area (km²), bordering countries**Economy**Currency, GDP**Demography**Population**Communication**International phone code, top-level domain (TLD)**Identity/branding**Flag (SVG), flag emoji, flag colors (HEX/RGB)**History**Independence date**Classification**Region / continent, WMO code**Localization**Name and region translated in 9 languages🌍 Available Languages
---------------------

[](#-available-languages)

Every country and region name is translated in all 9 languages below — the table shows how many countries have that language as an official/native language, not translation coverage (translation coverage is 100% across all languages).

You don't have to install all 9. Pick only the languages your app actually serves at install time, and add or remove languages later — Laravel Countries manages the translation rows for you, so your database only ever stores what you're using.

LanguageFlagCountryCountries where it's an official languageArabic🇸🇦Saudi Arabia25Dutch🇳🇱Netherlands3English🇬🇧United Kingdom67German🇩🇪Germany6Italian🇮🇹Italy4Portuguese🇧🇷Brazil9Russian🇷🇺Russia4Spanish🇪🇸Spain21Turkish🇹🇷Turkey2*Missing a language? [Contributions are welcome](CONTRIBUTING.md) — the guide explains how translations get reviewed.*

🚀 Getting Started
-----------------

[](#-getting-started)

Install via Composer:

```
composer require lwwcas/laravel-countries
```

Run the installer:

```
php artisan w-countries:install
```

That's it — the countries table is seeded and ready to query.

### Production / CI (Laravel 11, 12, and 13)

[](#production--ci-laravel-11-12-and-13)

In production, use `--force` to skip confirmation prompts:

```
php artisan w-countries:install --force
```

If migrations already ran during deploy and you only need the data:

```
php artisan w-countries:seed --languages=en,pt,es
```

To list the equivalent manual `db:seed` commands:

```
php artisan w-countries:seed --show-commands
```

See the [Seeders documentation](https://lwwcas.github.io/laravel-countries/setup/seeders.html) for the full production guide and manual seeder class reference.

### 🧩 Manage languages anytime

[](#-manage-languages-anytime)

Only need Portuguese and English today? Only seed those two — there's no need to carry all 9 languages in your database if your app doesn't use them:

```
php artisan w-countries:seed --languages=en,pt
```

Adding a new market later (say, Spanish) doesn't mean starting over — install the new language on top of what you already have. The same applies in reverse: if a language is no longer needed, you can remove it without touching the rest of your country data.

Full add/remove workflow and command reference → **[Available Languages docs](https://lwwcas.github.io/laravel-countries/introduction/available-languages.html)**

🧑‍💻 Usage &amp; Query Examples
------------------------------

[](#‍-usage--query-examples)

Basic lookups:

```
use Lwwcas\LaravelCountries\Models\Country;

Country::whereIso('BR')->first();
Country::whereIsoAlpha3('BRA')->first();
Country::whereSlug('brasil')->first();
```

Flags — SVG, emoji, and colors:

```
$country = Country::whereIso('FR')->first();

$country->flag_svg;    // SVG markup
$country->flag_emoji;  // 🇫🇷
$country->flag_colors; // ['#0055A4', '#FFFFFF', '#EF4135']
```

Phone codes &amp; currency:

```
Country::wherePhoneCode('+55')->first();
Country::whereGdp(1000)->get(); // GDP in billions USD
```

Geographic data — coordinates &amp; GeoJSON:

```
$country = Country::whereIso('JP')->first();

$country->latitude;
$country->longitude;
$country->geojson; // ready to drop into any map library
```

Language &amp; region:

```
Country::whereLanguage('en')->get();
Country::whereLanguages(['en', 'fr'])->get();
```

Looking for relationships, scopes, config, or translation helpers? → **[See the full documentation](https://lwwcas.github.io/laravel-countries/)**

🧪 Testing
---------

[](#-testing)

```
composer test
```

🤝 Contributing
--------------

[](#-contributing)

Contributions, translations, and bug reports are very welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.

👥 Credits
---------

[](#-credits)

- [Lucas Duarte](https://github.com/lwwcas)
- [Saad Batwa](https://github.com/Saad5400) — detailed review and corrections of Arabic country translations ([PR #45](https://github.com/lwwcas/laravel-countries/pull/45))
- [İlyas Özkurt](https://github.com/ilyasozkurt) — Turkish language translations ([PR #36](https://github.com/lwwcas/laravel-countries/pull/36))
- [All Contributors](../../contributors)

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [LICENSE.md](LICENSE.md) for more information.

---

Made with ❤️ for the Laravel community

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance92

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 86.5% 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 ~82 days

Recently: every ~0 days

Total

26

Last Release

33d ago

Major Versions

3.5.2 → 4.11.0.12024-11-01

PHP version history (4 changes)3.0.0PHP ^7.3|^8.0

3.4.0PHP ^7.3|^8.0|^8.1|^8.2

4.11.0.1PHP ^8.0|^8.1|^8.2

4.12.0.1PHP ^8.2|^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19727953?v=4)[Lucas Monteiro](/maintainers/lwwcas)[@lwwcas](https://github.com/lwwcas)

---

Top Contributors

[![lwwcas](https://avatars.githubusercontent.com/u/19727953?v=4)](https://github.com/lwwcas "lwwcas (115 commits)")[![ttesterink-arch](https://avatars.githubusercontent.com/u/283645696?v=4)](https://github.com/ttesterink-arch "ttesterink-arch (4 commits)")[![daniel-de-wit](https://avatars.githubusercontent.com/u/3015394?v=4)](https://github.com/daniel-de-wit "daniel-de-wit (3 commits)")[![vool](https://avatars.githubusercontent.com/u/441840?v=4)](https://github.com/vool "vool (2 commits)")[![Saad5400](https://avatars.githubusercontent.com/u/86385454?v=4)](https://github.com/Saad5400 "Saad5400 (2 commits)")[![mucenica-bogdan](https://avatars.githubusercontent.com/u/846097?v=4)](https://github.com/mucenica-bogdan "mucenica-bogdan (1 commits)")[![muhannadalhariri](https://avatars.githubusercontent.com/u/37214752?v=4)](https://github.com/muhannadalhariri "muhannadalhariri (1 commits)")[![myindexlike](https://avatars.githubusercontent.com/u/16356381?v=4)](https://github.com/myindexlike "myindexlike (1 commits)")[![hnasiry](https://avatars.githubusercontent.com/u/14115146?v=4)](https://github.com/hnasiry "hnasiry (1 commits)")[![ilyasozkurt](https://avatars.githubusercontent.com/u/4955440?v=4)](https://github.com/ilyasozkurt "ilyasozkurt (1 commits)")[![vadimwe](https://avatars.githubusercontent.com/u/2635452?v=4)](https://github.com/vadimwe "vadimwe (1 commits)")[![JustNawaf](https://avatars.githubusercontent.com/u/38926166?v=4)](https://github.com/JustNawaf "JustNawaf (1 commits)")

---

Tags

countriescountrycountry-codescountry-flagscurrencydatabaseeloquentgeojsongeolocationinternationalizationiso-3166laravellaravel-packagemigrationsphone-numbersphpregionssvgtranslationsworld-countrieslaravelgeolocationmultilingualcountrieslaravel-packagegeographycoordinatesISO codesgeojsonlwwcaslucas duartecountry datasvg mapsworld countries

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lwwcas-laravel-countries/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.8k2.5k](/packages/unopim-unopim)[bagisto/bagisto

Bagisto Laravel E-Commerce

28.0k175.2k9](/packages/bagisto-bagisto)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

16461.2k](/packages/relaticle-custom-fields)[slimani/filament-media-manager

A media manager plugin for Filament.

179.7k1](/packages/slimani-filament-media-manager)[mozex/laravel-scout-bulk-actions

Import, flush, and queue-import all your Laravel Scout searchable models at once. Auto-discovers models, runs in bulk, tracks progress.

1542.2k](/packages/mozex-laravel-scout-bulk-actions)[mominalzaraa/filament-localization

The first and only automatic Filament localization package with intelligent resource scanning, structured translation files, and comprehensive testing

103.5k](/packages/mominalzaraa-filament-localization)

PHPackages © 2026

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