brianfp/lumen-world
Larablocks Analysis
brianfp/lumen-world works with any PHP project: the latest release (v1.0, Jul 9, 2020) doesn't depend on Laravel.
Laravel 5 and 6 in earlier releases.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Jul 9, 2020)
- 1 downloads a month (needs 10,000)
- 0 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Jul 9, 2020.
- No releases in the last 12 months.
- First released: Apr 5, 2017.
- Monthly downloads: 1, down 86% from six months ago.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.
| Install | |
|---|---|
composer require brianfp/lumen-world |
|
| Latest Version: | v1.0 |
| PHP: | ^7.2.5 |
| Older releases: | 5 · 6 |
| License: | MIT |
| Last Updated: | Jul 9, 2020 |
| Links: | GitHub · Packagist |
Lumen World Models for Laravel World Database
This package focused on World Countries, Regions, and Cities database with locale support for Lumen.
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
Common attributes:
name: Common name of region(english).full_name: Full name or official name(english).code: ISO-3166-1-alpha2/ISO-3166-2 codelocal_name: translation of Common namelocal_full_name: translation of full namelocal_alias: alias in different languagelocal_abbr: Abbreviation
Country spec attributes:
emoji: Emoji flag of countrycapital: Captial of this countrycode_alpha3: Code of ISO-3166-1-alpha3currency_code: ISO-4177 Currency Code, e.g. USD, CNYcurrency_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
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
composer require
composer require brianfp/lumen-world
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
If you want contribute to this library, issue and pr are welcome. please following those steps.
- start a new laravel project and install this library.
- install orangehill/iseed.
- modify datas via sql.
- 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 - replace
delete()withtruncat(),cd database/seeds/ && sed -i 's/->delete()/->truncat()/g' World*.php - copy seeds files into library.
- commit your work. ;)
TODO
- change the way to seed data, eg. loading data from json?
- add front-end support
- find a way to update dataset
Thanks
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<khsing.cn(AT)gmail.com>.
Have a nice day.
Alternatives to brianfp/lumen-world
Database Seeds for Countries / Cities / Areas / Languages / Currancy with ready...
Türkiye İl İlçe Semt Muhit Mahalle ve Posta Kodları Laravel Paketi. Adds Turkish...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.0 | ^7.2.5 | MIT | ||
| v0.9 | >=7.1 | >=5.8.0 | MIT | |
| v0.8 | >=7.0 | >=5.3.0 | MIT | |
| v0.7 | >=7.0 | >=5.3.0 | MIT | |
| v0.6 | >=7.0 | >=5.3.0 | MIT | |
| v0.5 | >=7.0 | >=5.3.0 | MIT | |
| v0.4 | >=7.0 | >=5.3.0 | MIT | |
| v0.3 | >=7.0 | >=5.3.0 | MIT | |
| v0.2 | >=5.6.4 | ~5.4 | MIT | |
| v0.1 | >=5.5.9 | 5.x | MIT |