PHPackages                             edeoliv/laravel-countries-states-cities - 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. edeoliv/laravel-countries-states-cities

ActiveLibrary

edeoliv/laravel-countries-states-cities
=======================================

Laravel Countries States Cities DB Migration &amp; Seeder

v1.0.2(1y ago)115MITPHPPHP ^8.3

Since Jun 4Pushed 1y agoCompare

[ Source](https://github.com/edeoliv/laravel-countries-states-cities)[ Packagist](https://packagist.org/packages/edeoliv/laravel-countries-states-cities)[ Docs](https://github.com/edeoliv/laravel-countries-states-cities.git)[ RSS](/packages/edeoliv-laravel-countries-states-cities/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Countries States Cities DB Migration &amp; Seeder
=========================================================

[](#laravel-countries-states-cities-db-migration--seeder)

Countries States Cities Data for Laravel

Numbers
-------

[](#numbers)

ModelNumber of itemsCountry250State4961City148059Attributes
----------

[](#attributes)

Common attributes:

- `name`: Common name of Country(english).
- `iso2`: ISO-3166-2 code.
- `iso2`: ISO-3166-3 code.
- `numeric_code`: Country Numeric code.
- `phonecode`: Country Phone code.
- `capital`: Capital of this country.
- `currency`: ISO-4177 Currency Code, e.g. USD, CNY.
- `currency_name`: Currency Name.
- `currency_symbol`: Currency Symbol e.g. $, ¥.
- `tld`: Country code top-level domain e.g. .uk.
- `native`: Local name of the country.
- `region`: region of the country.
- `subregion`: Sub-region of the country.
- `timezones`: timezones the country.
    - `zoneName`: Zone Name e.g. America/New\_York.
    - `gmtOffset`: GMT offset e.g. -18000.
    - `gmtOffsetName`: GMT offset Name e.g. UTC-05:00.
    - `abbreviation`: abbreviation e.g. EST.
    - `tzName`: time zone Name e.g. Eastern Standard Time (North America).
- `translations`: Country name translations e.g.
    - "ar": "الولايات المتحدة الأمريكية"
    - "kr": "미국"
    - "fr": "États-Unis"
- `latitude`: latitude the country.
- `longitude`: latitude the country.
- `emoji`: Emoji flag of country e.g. 🇺🇸.
- `emojiU`: Emoji Unicode flag of country e.g U+1F1FA U+1F1F8.
- `flag`: Country has flag (boolean).
- `is_active`: Country has active (boolean).

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

[](#installation)

You can install the package via composer:

```
composer require edeoliv/laravel-countries-states-cities
```

Usage
-----

[](#usage)

Now run the following command to install .

```
php artisan countries-states-cities:install
```

Add seeder File in `database\seeders\DatabaseSeeder.php` add this line to use `php artisan db:seed` command.

```
public function run(): void
    {

        $this->call(CountriesStatesCitiesTableSeeder::class);
        ...
    }
```

Or you can Seeding Data of Countries States Cities, by run this command.

```
php artisan countries-states-cities:seeder
```

And you can refresh to re-seeding Data of Countries States Cities, by run this command.

```
php artisan countries-states-cities:seeder --refresh
```

You can specify the activation of countries through the country code ISO2 or ISO3, before processing the seed data in the config file. `config/countries-states-cities.php`

```
return [
    'countries' => [
        'activation' => [
            'default' => true,
            'only' => [
                'iso2' => ['SA','GB','DE'],
                'iso3' => ['USA','BRA','EGY'],
            ],
            'except' => [
                'iso2' => ['GA'],
                'iso3' => ['HTI'],
            ],
        ],
        'chunk_length' => 50,
    ],

    'states' => [
        'activation' => [
            'default' => true,
        ],
        'chunk_length' => 200,
    ],

    'cities' => [
        'activation' => [
            'default' => true,
        ],
        'chunk_length' => 200,
    ],
];
```

This means that only these two countries and the states and cities affiliated with them will be activated.

- Note: If activation only `iso2` an `iso3` are empty, the column is\_active take the `default` value in config file.
- Note: If Country is active, all States and Cities are active.
- Note: If activation except `iso2` or `iso3` the column is\_active take FALSE value.
- Note: If Country is not active, all States and Cities are not active.

Usage
-----

[](#usage-1)

you can get country by iso2 and iso3 or both.

if you want to get country by iso2 you can yes static function getByIso2

```
use App\Models\Country;

$sa = Country::getByIso2('SA');
$sa->name; // Saudi Arabia
$sa->iso2; // SA
$sa->iso3; // SAU
$sa->currency_symbol; // ﷼
$sa->native; // المملكة العربية السعودية
```

if you want to get country by iso3 you can use.

```
use App\Models\Country;

$bra = Country::getByIso3('BRA');
$bra->name; // Brazil
$bra->iso2; // BR
$bra->iso3; // BRA
$bra->currency_symbol; // R$
$bra->native; // Brasil
```

also if you want to get country by code iso2 ro iso3 you can use.

```
use App\Models\Country;

$bra = Country::getByCode('PT');
$bra->name; // Portugal
$bra->iso2; // PT
$bra->iso3; // PRT
$bra->currency_symbol; // €
$bra->native; // Portugal
```

### Scope

[](#scope)

you can use Scope to filter data is Active by use.

```
use App\Models\Country;

$countries = Country::active()->pluck('name','id');
```

Credits
-------

[](#credits)

- [Abdulmajeed Altwaireb](https://github.com/altwaireb)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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

Total

2

Last Release

673d ago

PHP version history (2 changes)v1.0.1PHP ^8.1

v1.0.2PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![altwaireb](https://avatars.githubusercontent.com/u/6729097?v=4)](https://github.com/altwaireb "altwaireb (3 commits)")[![edeoliv](https://avatars.githubusercontent.com/u/76831154?v=4)](https://github.com/edeoliv "edeoliv (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelcountriesstatescities

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/edeoliv-laravel-countries-states-cities/health.svg)

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

###  Alternatives

[pragmarx/countries

PHP Countries and Currencies

1.9k3.3M18](/packages/pragmarx-countries)[pragmarx/countries-laravel

Countries for Laravel

1471.1M2](/packages/pragmarx-countries-laravel)[altwaireb/laravel-world

Laravel World, Countries States Cities DB Migration &amp; Seeder

989.4k](/packages/altwaireb-laravel-world)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[dipeshsukhia/laravel-country-state-city-data

Country State City Data Provider

8230.8k](/packages/dipeshsukhia-laravel-country-state-city-data)[usamamuneerchaudhary/country-city-state

Country City State Data Provider for Laravel 12+

242.6k](/packages/usamamuneerchaudhary-country-city-state)

PHPackages © 2026

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