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

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

coolsam/laravel-mongodb-world
=============================

Provide countries, states, and cities relations database for mongodb in laravel using jenssegers/laravel-mongodb

v1.0.1(7y ago)152MITPHPPHP &gt;=7.0

Since Apr 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/coolsam726/laravel-mongo-world)[ Packagist](https://packagist.org/packages/coolsam/laravel-mongodb-world)[ RSS](/packages/coolsam-laravel-mongodb-world/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (8)Used By (0)

Laravel World Database for Laravel-MongoDB
==========================================

[](#laravel-world-database-for-laravel-mongodb)

This package focused on World Countries, Regions, and Cities database with locale support for Laravel using the Laravel-MongoDB package by Jenssegers.

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

[](#conceptions)

There are 5 main objects in this package.

- World: the earth world.
- Continent: 7 continent
- Country: 247 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.
- `full_name`: Full name or official name
- `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 Coolsam\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`.

\##Dependencies

- This package depends on jenssegers/laravel-mongodb. Ensure you finish all the setup steps and have your laravel app working with mongodb before you proceed to setup.

Setup
-----

[](#setup)

- `composer require`

```
composer require coolsam/laravel-mongodb-world
```

- Add Service Provider into `config/app.php`

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

- Publish and init

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

Usage
-----

[](#usage)

- get all Continent

```
use Coolsam\World\World;

World::Continents()
```

- get all Countries

```
use Coolsam\World\World;

World::Countries()
```

- get country by code

```
use Coolsam\World\World;

Country::getByCode('cn');
```

- get countries belong to a continent

```
use Coolsam\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();
```

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 Sam Maosa&lt;maosa.sam(AT)gmail.com&gt;.

Good luck being a real Big-Data artisan.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 90.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 ~79 days

Recently: every ~117 days

Total

7

Last Release

2850d ago

Major Versions

v0.5 → v1.02018-07-23

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

v0.2PHP &gt;=5.6.4

v0.3PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c07613c8ab7356eb1d69752c0f2dc5802aeca61029ea8d3e6b9e58bfacee6af?d=identicon)[coolsam726](/maintainers/coolsam726)

---

Top Contributors

[![khsing](https://avatars.githubusercontent.com/u/40765?v=4)](https://github.com/khsing "khsing (19 commits)")[![uovidiu](https://avatars.githubusercontent.com/u/76910?v=4)](https://github.com/uovidiu "uovidiu (2 commits)")

---

Tags

laravelmongodblocalecountrycityworldregionlaravel-mongodb

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[khsing/world

Provide countries, states, and cities relations database.

461146.3k1](/packages/khsing-world)[designmynight/laravel-mongodb-passport

A package to allow laravel/passport use with jenssegers/laravel-mongodb

68123.3k](/packages/designmynight-laravel-mongodb-passport)[nevadskiy/laravel-geonames

Populate your database using the GeoNames service.

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

PHPackages © 2026

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