PHPackages                             centrex/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. centrex/laravel-countries

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

centrex/laravel-countries
=========================

Countries database for laravel

v1.2.0(1y ago)02.2k[1 PRs](https://github.com/centrex/laravel-countries/pulls)MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Nov 20Pushed 1w agoCompare

[ Source](https://github.com/centrex/laravel-countries)[ Packagist](https://packagist.org/packages/centrex/laravel-countries)[ Docs](https://github.com/centrex/laravel-countries)[ RSS](/packages/centrex-laravel-countries/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (14)Versions (16)Used By (0)

Countries database for Laravel
==============================

[](#countries-database-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b8262e02299f0a53c9b8a55b254a95b57f1b0d1ab83e24e902651f2b07f1fd64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63656e747265782f6c61726176656c2d636f756e74726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/laravel-countries)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0238655f3c53623457d4b2e30f875423dd4b8640252ef75656b3d2d399da9a7e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c61726176656c2d636f756e74726965732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/centrex/laravel-countries/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/dc06d94ada782fb20ea3cf4b31d476820a0b2e23a00c7d9820a77c3d3beb5a5e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c61726176656c2d636f756e74726965732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/centrex/laravel-countries/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/528d3f67f70047058bd7221d71147f85f42ce9f6fec8a17c00680cf83ae72d0c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63656e747265782f6c61726176656c2d636f756e74726965733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/laravel-countries)

A complete country database seeded from a JSON source. Provides an Eloquent `Country` model with support for listing and sorting by any country field, and lookup by country code.

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

[](#installation)

```
composer require centrex/laravel-countries
php artisan vendor:publish --tag="laravel-countries-migrations"
php artisan migrate
php artisan db:seed --class="Centrex\LaravelCountries\Database\Seeders\CountrySeeder"
```

Usage
-----

[](#usage)

```
use Centrex\LaravelCountries\Models\Country;

// Get all countries
Country::all();

// Find by country code (ISO 3166-1)
Country::whereCountryCode('BD')->first();

// Get sorted list (sortable by: capital, citizenship, country-code, currency, ...)
$model = new Country();
$list = $model->getList('capital');   // sorted by capital city

// Get a single country by ID
$country = $model->getOne('BD');
```

### Config

[](#config)

```
php artisan vendor:publish --tag="laravel-countries-config"
```

```
// config/countries.php
'table_name' => 'countries',
```

### Used by laravel-addresses

[](#used-by-laravel-addresses)

This package is a dependency of `laravel-addresses` — the countries table provides the foreign key for address country validation.

Testing
-------

[](#testing)

```
composer test        # full suite
composer test:unit   # pest only
composer test:types  # phpstan
composer lint        # pint
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [centrex](https://github.com/centrex)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance72

Regular maintenance activity

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 67.1% 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 ~54 days

Total

10

Last Release

515d ago

PHP version history (3 changes)v1.0.0PHP ^8.0|^8.1

v1.0.1PHP ^8.1|^8.2

v1.2.0PHP ^8.2|^8.3|^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29769944?v=4)[Raisul Islam](/maintainers/rochi88)[@rochi88](https://github.com/rochi88)

---

Top Contributors

[![rochi88](https://avatars.githubusercontent.com/u/29769944?v=4)](https://github.com/rochi88 "rochi88 (47 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

laravelLaravel-Countriescentrex

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.1k43.2M632](/packages/spatie-laravel-medialibrary)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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