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

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

juanchopalen/laravel-world
==========================

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

07PHP

Since Apr 28Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#laravel-world)

This package will allow you to add all Countries, States, Cities Data DB Migration &amp; Seeder for Laravel

NOTE: This is a fork of altwaireb/laravel-world, created for use with Laravel 12.

[![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.
- `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 altwaireb/laravel-world
```

Usage
-----

[](#usage)

Now run the following command to install .

```
php artisan world: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(WorldTableSeeder::class);
        ...
    }
```

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

```
php artisan world:seeder
```

And you can refresh to re-seeding Data of Countries States Cities, by run 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 the countries is activation , this insert only two Countries `( Albania , Argentina )` with 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 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

16

—

LowBetter than 5% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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