Download the PHP package mledoze/countries without Composer
On this page you can find all versions of the php package mledoze/countries. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package countries
World countries in JSON, CSV, XML and YAML.
Countries data
This repository contains a list of world countries, as defined by ISO Standard 3166-1,
in JSON, CSV, XML and YAML. Warning: not all entities in this project are independent countries; refer to the independent
property to know if the country is considered a sovereign state.
Each line contains the country:
name
common
- common name in englishofficial
- official name in englishnative
- list of all native names- key: three-letter ISO 639-3 language code
- value: name object
- key:
official
- official name translation - key:
common
- common name translation
- key:
- country code top-level domain (
tld
) - code ISO 3166-1 alpha-2 (
cca2
) - code ISO 3166-1 numeric (
ccn3
) - code ISO 3166-1 alpha-3 (
cca3
) - code International Olympic Committee (
cioc
) - ISO 3166-1 independence status (
independent
) (denotes the country is considered a sovereign state) - ISO 3166-1 assignment status (
status
) - UN Member status (
unMember
) currencies
- list of all currencies- key: ISO 4217 currency code
- value: currency object
- key:
name
name of the currency - key:
symbol
symbol of the currency
- key:
- International Direct Dialing info (
idd
)root
- the root geographical code prefix. e.g. +6 for New Zealand, +4 for UK.suffixes
- list of all suffixes assigned to this country. 4 for NZ, 809, 829, and 849 for Dominican Republic.
- capital city(ies) (
capital
) - alternative spellings (
altSpellings
) - region
- subregion
- list of official languages (
languages
)- key: three-letter ISO 639-3 language code
- value: name of the language in english
- list of name translations (
translations
)- key: three-letter ISO 639-3 language code
- value: name object
- key: official - official name translation
- key: common - common name translation
- latitude and longitude (
latlng
) demonyms
- name of residents, translated & genderized- key: three-letter ISO 639-3 language code
- value: genderized demonym object
- key:
f
(female) orm
(male) - value: genderized demonym translation
- key:
- landlocked status (
landlocked
) - land borders (
borders
) - land area in km² (
area
) - Emoji flag (
flag
) - calling codes (
callingCodes
)
Additional data
The data folder contains additional data such as the countries GeoJSON outlines and flags in SVG format.
Examples
JSON
GeoJSON and TopoJSON outlines
See an example for Germany: GeoJSON or TopoJSON.
CSV
XML
YAML
Customising the output
The data files provided in the dist
directory include all available fields, but is also possible to build a custom version of the data with certain fields excluded.
To do this, you will first need a working PHP installation, composer and a local copy of this repository. Once you have these, open a terminal in your local version of this project's root directory and run this command to install the necessary dependencies:
After this finishes, run the following command (here we will exclude the tld
field from the output, but you can exclude any field you want):
You can also exclude multiple fields:
If you prefer to include only some fields (this can not be combined with --exclude-field
):
The generated files are put into the dist
directory, but you can change this to another existing directory:
You can also choose to only generate some of the output formats:
Showcase
Projects using this dataset:
- REST Countries
- International Telephone Input
- Telephone JS
- Countries of the World
- Country Prefix Codes For Go
- Country Info Mapper in Go
- Visa requirements in JSON
- Country picker modal for React Native
- Agnostic Virtual Assistant
How to contribute?
Please refer to CONTRIBUTING.
To do
- add the type of the country (country, sovereign state, public body, territory, etc.)
- pull in data automatically from CLDR at build time (idea from @Munter, see #108)
Sources
https://www.currency-iso.org/ for currency codes.
Region and subregion are taken from https://github.com/hexorx/countries.
GeoJSON outlines come from http://thematicmapping.org/downloads/world_borders.php.
The rest comes from Wikipedia.
Credits
Thanks to:
- @Glazz for his help with country calling codes
- @hexorx for his work (https://github.com/hexorx/countries)
- @frederik-jacques for the capital cities
- @fayer for the population, geolocation, demonym and area data
- @ancosen for his help with the borders data
- @herrjemand for country names and various fixes
- all the contributors: https://github.com/mledoze/countries/graphs/contributors
License
See LICENSE.
Flags are not licensed under the ODbL license; see https://en.wikipedia.org/wiki/Wikipedia:Copyright_on_emblems for more information.
All versions of countries with dependencies
ext-gettext Version *
php Version >=8.1
symfony/console Version ~5.4|~6.3
symfony/yaml Version ~5.4|~6.3