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

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

appolous/world
==============

Provide countries, states, and cities relations database.

v12.1(1y ago)011MITPHPPHP &gt;7.3|^8.0

Since Mar 16Pushed 1y agoCompare

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/a6f0e5c0c137a77104079c7315070074e875ac168e3281394792f5712ba8daf9/68747470733a2f2f706f7365722e707567782e6f72672f6170706f6c6f75732f776f726c642f762f737461626c65)](https://packagist.org/packages/appolous/world)[![Total Downloads](https://camo.githubusercontent.com/e3704413d37e5f5c265fa7ff64c24eb3e0a4542851a6f2cb9072e4066fe8ad42/68747470733a2f2f706f7365722e707567782e6f72672f6170706f6c6f75732f776f726c642f646f776e6c6f616473)](https://packagist.org/packages/appolous/world)[![MIT Licensed](https://camo.githubusercontent.com/d9b7bef2d96bd8336c4726f1f85e765b994e7d5a93213b4555413fa04f3b7bc4/68747470733a2f2f706f7365722e707567782e6f72672f6170706f6c6f75732f776f726c642f6c6963656e7365)](LICENSE.md)[![Buy Me A Coffee](https://camo.githubusercontent.com/f5e8ffeb9a30db270848f189f4ee88e458469d2d1c17fd263ea38e6d8bf36f53/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d6275795f6d655f61254332254130636f666665652d677261793f6c6f676f3d6275792d6d652d612d636f66666565)](https://buymeacoffee.com/appolous)

Package Status
==============

[](#package-status)

As the original package is no longer under active development, we are updating this package just to support the latest version of Laravel. Everything else will remain the same.

Support Laravel 7.x - 12.x

Laravel World Database
======================

[](#laravel-world-database)

This package focused on World Countries, Regions, and Cities database with locale support for Laravel.

Conceptions
-----------

[](#conceptions)

There are 5 main objects in this package.

- World: the earth world.
- Continent: 7 continent
- Country: 248 countries
- Division: Divisions such as state/province.
- City: the last level of region, some cities up to Country, some up to Division.

### Attributes

[](#attributes)

Common attributes:

- `name`: Common name of region(english).
- `full_name`: Full name or official name(english).
- `code`: ISO-3166-1-alpha2/ISO-3166-2 code
- `local_name`: translation of Common name
- `local_full_name`: translation of full name
- `local_alias`: alias in different language
- `local_abbr`: Abbreviation

Country spec attributes:

- `emoji`: Emoji flag of country
- `capital`: Captial of this country
- `code_alpha3`: Code of ISO-3166-1-alpha3
- `currency_code`: ISO-4177 Currency Code, e.g. USD, CNY
- `currency_name`: ISO-4177 Currency Name,
- `local_currency_name`: ISO-4177 Currency name in locale

Example:

```
use Khsing\World\World;
$china = World::getByCode('cn');
$china->setLocale('zh-cn');
$china->name; // China
$china->local_name; // 中国
$china->full_name; // People's Republic of China
$china->local_full_name; // 中华人民共和国
$china->emoji; // 🇨🇳
$china->callingcode; // 86
$china->code; // CN
$china->code_alpha3; // CHN
$china->has_division; // true
$china->currency_code; // CNY
$china->currency_name; // Yuan Renminbi
$china->local_currency_name; // 人民币
```

### Localization

[](#localization)

Right now, only English(default and fallback) and Chinese-Simp `zh-cn` are supported. Locale settings is following Laravel project settings in `config/app.php`.

Setup
-----

[](#setup)

- `composer require`

```
composer require appolous/world
```

- Add Service Provider into `config/app.php`, (Only required before Laravel 5.5)

```
'providers' => [
    // ...
    Khsing\World\WorldServiceProvider::class,
]
```

- Publish and init

```
php artisan vendor:publish --force --provider="Khsing\World\WorldServiceProvider"
composer dump-autoload
php artisan world:init
```

Usage
-----

[](#usage)

- get all Continent

```
use Khsing\World\World;

World::Continents()
```

- get all Countries

```
use Khsing\World\World;

World::Countries()
```

- get country/city/division by code

```
use Khsing\World\World;

World::getByCode('cn'); // iso-3166 alpha 2 code
World::getByCode('chn'); // iso-3166 alpha 3 code
World::getByCode('cn-11'); // Beijing
```

- get countries belong to a continent

```
use Khsing\World\Models\Continent;

$asia = Continent::getByCode('AS');
$countries = $asia->countries()->get();
// or use children method
$countries = $asia->children();
```

- get continent or parent

```
$china = Country::getByCode('cn');
$asia = $china->parent();
```

- get division/state/province via Conutry

```
$china = Country::getByCode('cn');
$provinces = $china->divisions()->get()
// or use children method
$provinces = $china->children();
```

- get cities via Country or Division.

```
$china = Country::getByCode('cn');
// check has_division to determine next level is division or city.
$china->has_division; // true, otherwise is false
$regsions = $china->children();
```

Contributions
-------------

[](#contributions)

If you want contribute to this library, issue and pr are welcome. please following those steps.

1. start a new laravel project and install this library.
2. install [orangehill/iseed](https://github.com/orangehill/iseed).
3. modify datas via sql.
4. generate seeds via `artisan iseed world_cities,world_cities_locale,world_continents,world_continents_locale,world_countries,world_countries_locale,world_divisions,world_divisions_locale`
5. replace `delete()` with `truncate()`, `cd database/seeders/ && sed -i 's/->delete()/->truncate()/g' World*.php`
6. copy seeds files into library.
7. commit your work. ;)

TODO
----

[](#todo)

- change the way to seed data, eg. loading data from json?
- add front-end support
- find a way to update dataset

Data Sources
------------

[](#data-sources)

- [ISO 639-1 Standard Language Codes](https://www.knowledgebase-script.com/kb/article/iso-639-1-standard-language-codes-255.html): language codes
- [ISO 639-1 standard language codes](https://www.andiamo.co.uk/resources/iso-language-codes/): language codes
- [United Nations Statistics Division: Standard country or area codes for statistical use (M49)](https://unstats.un.org/unsd/methodology/m49/overview/): ISO-3166-alpha3 code and country list.
- [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2): main data source

Thanks
------

[](#thanks)

- [moolighty/geo](https://github.com/moolighty/geo)
- [mledoze/countries](https://github.com/mledoze/countries)
- [cn/GB2260](https://github.com/cn/GB2260)

About
-----

[](#about)

This package published under MIT license. If you have any question or suggestion, please feel free to submit a issue, or email me Guixing&lt;khsing.cn(AT)gmail.com&gt;.

Have a nice day.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance45

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.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

Unknown

Total

1

Last Release

428d ago

### Community

Maintainers

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

---

Top Contributors

[![khsing](https://avatars.githubusercontent.com/u/40765?v=4)](https://github.com/khsing "khsing (38 commits)")[![alanyeong](https://avatars.githubusercontent.com/u/1586318?v=4)](https://github.com/alanyeong "alanyeong (4 commits)")[![geoffreyvanwyk](https://avatars.githubusercontent.com/u/194185?v=4)](https://github.com/geoffreyvanwyk "geoffreyvanwyk (2 commits)")[![uovidiu](https://avatars.githubusercontent.com/u/76910?v=4)](https://github.com/uovidiu "uovidiu (2 commits)")[![mednasserallah](https://avatars.githubusercontent.com/u/23226046?v=4)](https://github.com/mednasserallah "mednasserallah (2 commits)")[![rbridge](https://avatars.githubusercontent.com/u/916258?v=4)](https://github.com/rbridge "rbridge (2 commits)")[![Human018](https://avatars.githubusercontent.com/u/8413094?v=4)](https://github.com/Human018 "Human018 (2 commits)")[![nbyloff](https://avatars.githubusercontent.com/u/517059?v=4)](https://github.com/nbyloff "nbyloff (1 commits)")[![sitehandy](https://avatars.githubusercontent.com/u/22477788?v=4)](https://github.com/sitehandy "sitehandy (1 commits)")[![abhishek6262](https://avatars.githubusercontent.com/u/16699718?v=4)](https://github.com/abhishek6262 "abhishek6262 (1 commits)")[![yswtrue](https://avatars.githubusercontent.com/u/1270490?v=4)](https://github.com/yswtrue "yswtrue (1 commits)")[![amirolzolkifli](https://avatars.githubusercontent.com/u/6100743?v=4)](https://github.com/amirolzolkifli "amirolzolkifli (1 commits)")[![balduinofernando](https://avatars.githubusercontent.com/u/20538071?v=4)](https://github.com/balduinofernando "balduinofernando (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![Kauto](https://avatars.githubusercontent.com/u/6749584?v=4)](https://github.com/Kauto "Kauto (1 commits)")[![mokhosh](https://avatars.githubusercontent.com/u/6499685?v=4)](https://github.com/mokhosh "mokhosh (1 commits)")[![nauman-coeus](https://avatars.githubusercontent.com/u/42341849?v=4)](https://github.com/nauman-coeus "nauman-coeus (1 commits)")

---

Tags

countrycityworldregion

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[khsing/world

Provide countries, states, and cities relations database.

461146.3k1](/packages/khsing-world)[epigra/trgeozones

Türkiye İl İlçe Semt Muhit Mahalle ve Posta Kodları Laravel Paketi. Adds Turkish Geographical Zones Support to your project including Cities, Districts and Countries in Turkish

8820.3k](/packages/epigra-trgeozones)[nevadskiy/laravel-geonames

Populate your database using the GeoNames service.

2715.1k](/packages/nevadskiy-laravel-geonames)[woenel/prpcmblmts

Philippines region, province, cities/municipalities and barangays Laravel migration and table seeder.

2818.3k](/packages/woenel-prpcmblmts)[tomatophp/filament-locations

Database Seeds for Countries / Cities / Areas / Languages / Currancy with ready to use resources for FilamentPHP

2320.8k6](/packages/tomatophp-filament-locations)[salibhdr/typhoon-iran-cities

A laravel package for importing all regions such as provinces, counties, cities, city districts, rural districts and villages of iran into database accurately

6121.0k](/packages/salibhdr-typhoon-iran-cities)

PHPackages © 2026

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