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

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

brianfp/lumen-world
===================

Provide countries, states, and cities models database.

v1.0(5y ago)04.8k↓33.3%MITPHPPHP ^7.2.5

Since Apr 5Pushed 5y agoCompare

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

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

Lumen World Models for Laravel World Database
=============================================

[](#lumen-world-models-for-laravel-world-database)

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

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 Lumen project settings in `config/app.php`.

Setup
-----

[](#setup)

- `composer require`

```
composer require brianfp/lumen-world
```

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 `truncat()`, `cd database/seeds/ && sed -i 's/->delete()/->truncat()/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

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

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 67.4% 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 ~132 days

Recently: every ~178 days

Total

10

Last Release

2129d ago

Major Versions

v0.9 → v1.02020-07-09

PHP version history (5 changes)v0.1PHP &gt;=5.5.9

v0.2PHP &gt;=5.6.4

v0.3PHP &gt;=7.0

v0.9PHP &gt;=7.1

v1.0PHP ^7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/a91f7c8918681b974b97f16953e37f2f76aa5495864e8cb7c70d56cdd9a3603f?d=identicon)[Brian-FP](/maintainers/Brian-FP)

---

Top Contributors

[![khsing](https://avatars.githubusercontent.com/u/40765?v=4)](https://github.com/khsing "khsing (29 commits)")[![brianfp](https://avatars.githubusercontent.com/u/15164262?v=4)](https://github.com/brianfp "brianfp (4 commits)")[![mednasserallah](https://avatars.githubusercontent.com/u/23226046?v=4)](https://github.com/mednasserallah "mednasserallah (2 commits)")[![uovidiu](https://avatars.githubusercontent.com/u/76910?v=4)](https://github.com/uovidiu "uovidiu (2 commits)")[![geoffreyvanwyk](https://avatars.githubusercontent.com/u/194185?v=4)](https://github.com/geoffreyvanwyk "geoffreyvanwyk (2 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)")[![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)")

---

Tags

lumencountrycityworldregion

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/brianfp-lumen-world/health.svg)](https://phpackages.com/packages/brianfp-lumen-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)[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)[nevadskiy/laravel-geonames

Populate your database using the GeoNames service.

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

Geonames importer and models for Eloquent ORM

311.7k](/packages/yurtesen-geonames)

PHPackages © 2026

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