Download the PHP package coliving/world without Composer
On this page you can find all versions of the php package coliving/world. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package world
Laravel World Database
This package focused on World Countries, Regions, and Cities database with locale support for Laravel.
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:
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
-
composer require
-
Add Service Provider into
config/app.php
, (Only required before Laravel 5.5) - Publish and init
Usage
-
get all Continent
-
get all Countries
-
get country/city/division by code
-
get countries belong to a continent
-
get continent or parent
-
get division/state/province via Conutry
- get cities via Country or Division.
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()
withtruncate()
,cd database/seeders/ && sed -i 's/->delete()/->truncate()/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
Data Sources
- ISO 639-1 Standard Language Codes: language codes
- ISO 639-1 standard language codes: language codes
- United Nations Statistics Division: Standard country or area codes for statistical use (M49): ISO-3166-alpha3 code and country list.
- ISO 3166-2: main data source
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.