PHPackages                             brnysn/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. [Localization &amp; i18n](/categories/localization)
4. /
5. brnysn/laravel-world

ActiveLibrary[Localization &amp; i18n](/categories/localization)

brnysn/laravel-world
====================

The simplest way to add country, state and city to Laravel application.

2.0.0(2y ago)32.7k[4 PRs](https://github.com/brnysn/Laravel-World/pulls)MITPHPPHP ^8.0

Since Oct 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/brnysn/Laravel-World)[ Packagist](https://packagist.org/packages/brnysn/laravel-world)[ Docs](https://github.com/brnysn/laravel-world)[ RSS](/packages/brnysn-laravel-world/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (9)Dependencies (7)Versions (14)Used By (0)

The simplest way to add country, state and city to Laravel application.
=======================================================================

[](#the-simplest-way-to-add-country-state-and-city-to-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8c8d1b7fc5c40df45b625b4587cf8134fb94a38c50947ada16ca885d47f3719c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62726e79736e2f6c61726176656c2d776f726c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/brnysn/laravel-world)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/712c9f72eea13f16281b60cf68a5b664ee08083df06836e5f49e9867fa3883fb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f62726e79736e2f6c61726176656c2d776f726c642f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/brnysn/laravel-world/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f469deb1e5c564f1f260f6a797bdd2f9ddf815ada6649bf1b30668e5c621172c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62726e79736e2f6c61726176656c2d776f726c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/brnysn/laravel-world)

The simplest way to add country, state and city to Laravel application.

Data is taken from [dr5hn/countries-states-cities-database](https://github.com/dr5hn/countries-states-cities-database). Thanks to [dr5hn](https://github.com/dr5hn/) for the great work.

Data is last updated on 2022-10-26.

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

[](#installation)

Install the package via composer:

```
composer require brnysn/laravel-world
```

Publish the config file with:

```
php artisan vendor:publish --tag="world-config"
```

Define whether to use uuid or id in the config file: Migrations will be created according to this setting.

```
return [
    'use_uuid' => false,
];
```

Publish and run the migrations with:

```
php artisan vendor:publish --tag="world-migrations"
php artisan migrate
```

After the migration has been published you can add the countries, states and cities to your database by running:

```
php artisan db:seed --class="Brnysn\\World\\Database\\Seeders\\WorldSeeder"
```

Seeding the database will take a while.

Add `HasWorldAddress` trait to your models to add the country, state and city relationship:

```
use Brnysn\World\Traits\HasWorldAddress;

class {class_name} extends Model
{
    use HasWorldAddress;
}
```

Usage
-----

[](#usage)

```
// Get Data
use Brnysn\World\Models\Country;
use Brnysn\World\Models\State;
use Brnysn\World\Models\City;

$country = Country::find(1);
$state = State::find(1);
$city = City::find(1);

// Get Relationship
$country->states;
$state->cities;
$city->state;
$city->country;

// Query
$country->states()->where('name', 'like', '%state%')->get();
$state->cities()->where('name', 'like', '%city%')->get();

// Set Address of a model with HasWorldAddress trait
$model->changeCountry($country);
$model->changeState($state);
$model->changeCity($city);
$model->changeAddress($country, $state, $city);

// Get details of address of a model with HasWorldAddress trait
$model->country->name;
$model->state->name;
```

Changelog
---------

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Yasin BARAN](https://github.com/brnysn)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.3% 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 ~42 days

Recently: every ~74 days

Total

9

Last Release

1011d ago

Major Versions

0.0.3 → 1.0.02022-10-26

1.2.2 → 2.0.02023-09-19

PHP version history (2 changes)0.0.1PHP ^8.1

0.0.3PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/87d229df2202b349a2115057521ca84b60406f1912b537673c969ba665fc3115?d=identicon)[brnysn](/maintainers/brnysn)

---

Top Contributors

[![brnysn](https://avatars.githubusercontent.com/u/31011885?v=4)](https://github.com/brnysn "brnysn (42 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] (1 commits)")

---

Tags

addresslaravellocalizationlaravelcountriesstatescitieslaravel-addressbrnysn

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[nnjeim/world

Laravel countries, states, cities, currencies, languages and IP geolocation

976437.5k7](/packages/nnjeim-world)[altwaireb/laravel-world

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

9911.2k](/packages/altwaireb-laravel-world)[elegantly/laravel-translator

All on one translations management for Laravel

6326.3k](/packages/elegantly-laravel-translator)[osama-98/laravel-enum-translatable

A Laravel package that provides translatable enum functionality with easy-to-use methods for working with enum values and their translations

561.1k](/packages/osama-98-laravel-enum-translatable)[pharaonic/laravel-locations

Laravel - Countries\[States/Cities, Currency, Phone Code, Languages, Capital\] &amp; Continents &amp; Timezones.

102.6k1](/packages/pharaonic-laravel-locations)[usamamuneerchaudhary/country-city-state

Country City State Data Provider for Laravel 12+

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

PHPackages © 2026

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