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

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

bardolf69/laravel11-countries-states-cities
===========================================

Laravel Countries States Cities DB Migration &amp; Seeder

v1.0.2(1mo ago)059MITPHPPHP ^8.2

Since Jun 14Pushed 1mo ago1 watchersCompare

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

READMEChangelog (3)Dependencies (26)Versions (5)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 bardolf69/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 Bardolf69](https://github.com/bardolf69)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance90

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~324 days

Total

3

Last Release

49d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/758419555234fa5b6bfc92e2be022f0ace30c7c43209ac15d26a0557928a340a?d=identicon)[bardolf69](/maintainers/bardolf69)

---

Top Contributors

[![bardolf69](https://avatars.githubusercontent.com/u/47841636?v=4)](https://github.com/bardolf69 "bardolf69 (3 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravelcountriesstatescities

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[altwaireb/laravel-world

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

989.4k](/packages/altwaireb-laravel-world)[spatie/laravel-model-flags

Add flags to Eloquent models

4301.1M1](/packages/spatie-laravel-model-flags)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[spatie/laravel-sql-commenter

Add comments to SQL queries made by Laravel

1931.4M1](/packages/spatie-laravel-sql-commenter)[spatie/laravel-deleted-models

Automatically copy deleted records to a separate table

409109.8k4](/packages/spatie-laravel-deleted-models)

PHPackages © 2026

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