PHPackages                             laravel-enso/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. laravel-enso/countries

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

laravel-enso/countries
======================

Countries for Laravel Enso

2.8.4(2mo ago)039.9k↑103%38MITPHPCI failing

Since Oct 31Pushed 2mo ago3 watchersCompare

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

READMEChangelogDependencies (15)Versions (54)Used By (8)

Countries
=========

[](#countries)

[![License](https://camo.githubusercontent.com/372f5e8a56dc8c579bb5cffe01c54e22a261196c09a2016c94b309ace403c3c0/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f636f756e74726965732f6c6963656e7365)](LICENSE)[![Stable](https://camo.githubusercontent.com/0763c814e1998f58d74f11d1d0d7428964641d14c4501e897b4cb95406f3acc1/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f636f756e74726965732f76657273696f6e)](https://packagist.org/packages/laravel-enso/countries)[![Downloads](https://camo.githubusercontent.com/0061b4a7a34939ba07adcdd48027305a910f0629bcf6aebd8038fefe1e938bac/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f636f756e74726965732f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/countries)[![PHP](https://camo.githubusercontent.com/da7cf113b588d26fe679dfefe4a15009272ed358ad4e786ad3c78b45faa61d69/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d3737376262342e737667)](composer.json)[![Issues](https://camo.githubusercontent.com/71ad7254c55c7d14c7cd06cb17947691e95af678b84638ae38c5ff9ea3cf63d5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f636f756e74726965732e737667)](https://github.com/laravel-enso/countries/issues)[![Merge Requests](https://camo.githubusercontent.com/aecae1a741ce5bc2f4cbfe71720b3178329cbeec6977c550f2c36cb51694746a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f636f756e74726965732e737667)](https://github.com/laravel-enso/countries/pulls)

Description
-----------

[](#description)

Countries provides the country reference dataset used across the Laravel Enso ecosystem.

The package ships the `countries` table, a JSON-backed seeder for the full country list, an Eloquent model with a few convenience behaviors, and an authenticated options endpoint meant for select inputs.

It is a foundational backend package for address management, currencies, webshop flows, and any feature that needs normalized country metadata such as ISO codes, currency details, calling codes, or flags.

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

[](#installation)

This package comes pre-installed in Laravel Enso applications that require country metadata.

For standalone installation in an Enso-based application:

```
composer require laravel-enso/countries
```

The package automatically:

- loads its API routes
- loads its migrations
- publishes its seeders when requested

Run the migrations after installation:

```
php artisan migrate
```

If you want the package seeder in your application's database seeders directory, publish it with:

```
php artisan vendor:publish --tag=countries-seeder
```

Then seed the table:

```
php artisan db:seed --class="LaravelEnso\Countries\Database\Seeders\CountrySeeder"
```

Features
--------

[](#features)

- Creates the `countries` table with ISO, currency, region, and calling metadata.
- Ships a JSON-backed seeder for the full country dataset.
- Provides an Eloquent `Country` model with rememberable lookup keys.
- Exposes an authenticated `options` endpoint for select inputs.
- Returns only active countries through the options endpoint.
- Includes a region label helper that adapts for Romania and the United States.

Usage
-----

[](#usage)

Fetch active country options through the API:

```
route('core.countries.options');
```

Query the model directly:

```
use LaravelEnso\Countries\Models\Country;

$romania = Country::whereIso31662('RO')->firstOrFail();

$label = $romania->regionLabel();
```

The options endpoint serializes countries in a frontend-friendly shape:

```
{
  "id": 1,
  "name": "Romania",
  "currencyCode": "RON"
}
```

::: warning Note The package exposes only active countries through its options endpoint.

If you seed or modify the dataset manually, remember that inactive rows will not be returned by `core.countries.options`. :::

API
---

[](#api)

### Routes

[](#routes)

All package routes are registered under:

- prefix: `api/core/countries`
- name prefix: `core.countries.`
- middleware: `api`, `auth`, `core`

Endpoints:

- `GET /api/core/countries/options`

### Controller

[](#controller)

`LaravelEnso\Countries\Http\Controllers\Options`

Behavior:

- builds select-style options through `LaravelEnso\Select\Traits\OptionsBuilder`
- filters by active countries only
- allows querying by `name` and `iso_3166_3`

### Resource

[](#resource)

`LaravelEnso\Countries\Http\Resources\Country`

Serialized attributes:

- `id`
- `name`
- `currencyCode`

### Model

[](#model)

`LaravelEnso\Countries\Models\Country`

Useful traits:

- `ActiveState`
- `AvoidsDeletionConflicts`
- `HasFactory`
- `Rememberable`

Rememberable keys:

- `id`
- `iso_3166_2`
- `name`

Useful method:

- `regionLabel(): string`

### Seeder

[](#seeder)

`LaravelEnso\Countries\Database\Seeders\CountrySeeder`

Reads the dataset from:

- `vendor/laravel-enso/countries/database/countries.json`

Depends On
----------

[](#depends-on)

Required Enso packages:

- [`laravel-enso/core`](https://docs.laravel-enso.com/backend/core.html) [↗](https://github.com/laravel-enso/core)
- [`laravel-enso/dynamic-methods`](https://docs.laravel-enso.com/backend/dynamic-methods.html) [↗](https://github.com/laravel-enso/dynamic-methods)
- [`laravel-enso/enums`](https://docs.laravel-enso.com/backend/enums.html) [↗](https://github.com/laravel-enso/enums)
- [`laravel-enso/helpers`](https://docs.laravel-enso.com/backend/helpers.html) [↗](https://github.com/laravel-enso/helpers)
- [`laravel-enso/migrator`](https://docs.laravel-enso.com/backend/migrator.html) [↗](https://github.com/laravel-enso/migrator)
- [`laravel-enso/rememberable`](https://docs.laravel-enso.com/backend/rememberable.html) [↗](https://github.com/laravel-enso/rememberable)
- [`laravel-enso/select`](https://docs.laravel-enso.com/backend/select.html) [↗](https://github.com/laravel-enso/select)

Framework dependency:

- [`laravel/framework`](https://github.com/laravel/framework) [↗](https://github.com/laravel/framework)

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance86

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~56 days

Recently: every ~1 days

Total

43

Last Release

74d ago

Major Versions

1.1.9 → 2.0.02020-06-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (32 commits)")[![gandesc](https://avatars.githubusercontent.com/u/14071925?v=4)](https://github.com/gandesc "gandesc (23 commits)")[![raftx24](https://avatars.githubusercontent.com/u/10864136?v=4)](https://github.com/raftx24 "raftx24 (9 commits)")[![GITmanuela](https://avatars.githubusercontent.com/u/44998004?v=4)](https://github.com/GITmanuela "GITmanuela (6 commits)")[![vmcvlad](https://avatars.githubusercontent.com/u/37445394?v=4)](https://github.com/vmcvlad "vmcvlad (6 commits)")[![AbdullahiAbdulkabir](https://avatars.githubusercontent.com/u/33360580?v=4)](https://github.com/AbdullahiAbdulkabir "AbdullahiAbdulkabir (3 commits)")

---

Tags

countrieslaravellaravel-ensophpcountriesmanagerlaravel-ensoenso

### Embed Badge

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

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

###  Alternatives

[laravel-enso/data-import

Excel Importer dependency for Laravel Enso

2044.0k6](/packages/laravel-enso-data-import)[laravel-enso/localisation

Language and translation management for Laravel Enso

1362.8k10](/packages/laravel-enso-localisation)[laravel-enso/tutorials

Tutorial management backend for Laravel Enso

1140.7k](/packages/laravel-enso-tutorials)[laravel-enso/core

The backend shell of a Laravel Enso application

3465.3k205](/packages/laravel-enso-core)[laravel-enso/permissions

Permission management for Laravel Enso

1244.2k51](/packages/laravel-enso-permissions)[laravel-enso/tables

Server-side data tables and export backend for Laravel Enso

63355.1k83](/packages/laravel-enso-tables)

PHPackages © 2026

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