PHPackages                             altwaireb/laravel-world - 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. altwaireb/laravel-world

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

altwaireb/laravel-world
=======================

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

v1.1.0(7mo ago)989.4k↓34.6%16[3 PRs](https://github.com/altwaireb/laravel-world/pulls)MITPHPPHP ^8.2CI passing

Since Jun 24Pushed 4mo ago3 watchersCompare

[ Source](https://github.com/altwaireb/laravel-world)[ Packagist](https://packagist.org/packages/altwaireb/laravel-world)[ Docs](https://github.com/altwaireb/laravel-world)[ GitHub Sponsors](https://github.com/Altwaireb)[ RSS](/packages/altwaireb-laravel-world/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (6)Used By (0)

Laravel World
=============

[](#laravel-world)

This package allows you to add all Countries, States, and Cities data with DB Migration &amp; Seeder for Laravel.

[![Latest Version on Packagist](https://camo.githubusercontent.com/530ec4e2477b81f3511c777d4748bd5de5b0b069d139d943d42cd8770d904adf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c747761697265622f6c61726176656c2d776f726c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/altwaireb/laravel-world)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c42bdd7d8b7282c0cf7462c1caf79e29c056ff79519701837dba7e2d6a1af33d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c747761697265622f6c61726176656c2d776f726c642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/altwaireb/laravel-world/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c4efdacb8d717ffadcfe5771a8785f7637c3e4c00536a2416480935368cf0afc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c747761697265622f6c61726176656c2d776f726c642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/altwaireb/laravel-world/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/89ed37593a24e015cfb7bc33b47970b9164ca554b62a595e9d8392faa33e057c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c747761697265622f6c61726176656c2d776f726c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/altwaireb/laravel-world)

Numbers
-------

[](#numbers)

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

[](#attributes)

Common attributes:

- `name`: Common name of Country(english).
- `iso2`: ISO-3166-2 code.
- `iso3`: 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 altwaireb/laravel-world
```

Usage
-----

[](#usage)

Now run the following command to install:

```
php artisan world:install
```

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

```
public function run(): void
    {

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

Alternatively, you can seed data for Countries, States, and Cities by running this command.

```
php artisan world:seeder
```

You can also refresh to re-seed data for Countries, States, and Cities by running this command.

```
php artisan world: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/world.php`.

```
return [
    'insert_activations_only' => false,
    '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,
    ],
];
```

If you need to insert only the activated countries, this will insert only two countries (Albania and Argentina) with their States and Cities.

```
return [
    'insert_activations_only' => true,
    'countries' => [
        'activation' => [
            'default' => true,
            'only' => [
                'iso2' => ['AL','AR'],
                'iso3' => [],
            ],
            'except' => [
                'iso2' => [],
                'iso3' => [],
            ],
        ],
        'chunk_length' => 50,
    ],

    ...
];
```

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

- Note: If both `iso2` and `iso3` are empty, the `is_active` column takes the default value from the config file.
- Note: If a country is active, all its states and cities are active.
- Note: If a country is in the `except` list for `iso2` or `iso3`, the `is_active` column takes the FALSE value.
- Note: If a country is not active, all its states and cities are not active.

Usage
-----

[](#usage-1)

You can get a country by its ISO2 or ISO3 code, or both. If you want to get a country by ISO2, you can use the 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 a country by ISO3, you can use the following.

```
use App\Models\Country;

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

And if you want to get a country by either ISO2 or ISO3 code, you can use the following.

```
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 active data by using the following.

```
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

50

—

FairBetter than 96% of packages

Maintenance70

Regular maintenance activity

Popularity42

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.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 ~228 days

Total

3

Last Release

237d ago

### Community

Maintainers

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

---

Top Contributors

[![altwaireb](https://avatars.githubusercontent.com/u/6729097?v=4)](https://github.com/altwaireb "altwaireb (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")[![pixeline](https://avatars.githubusercontent.com/u/393415?v=4)](https://github.com/pixeline "pixeline (2 commits)")[![MahdiJalilvandir](https://avatars.githubusercontent.com/u/92047872?v=4)](https://github.com/MahdiJalilvandir "MahdiJalilvandir (1 commits)")

---

Tags

laravelcountriesstatescitiesLaravel-World

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/altwaireb-laravel-world/health.svg)

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

###  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)[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)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

203330.1k2](/packages/wnx-laravel-backup-restore)

PHPackages © 2026

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