You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package provides a simple way to download Geonames data and format it for friendly use.
(https://www.geonames.org/)
Requirements
PHP ^8.1
ext-curl
ext-json
ext-zip
Setup
You can install the package via Composer:
composer require farzai/geonames
Example
useFarzai\Geonames\Client;
// Create a new client$client = newClient();
// Get all countries and return $resource$resource = $client->getCountryInfo(); // \Farzai\Geonames\Resource\CollectionResource// Now, you can access the data using the following methods:$countries = $resource->asArray(); // Array$json = $resource->asJson(); // String// Or acccess data as entityforeach ($resource->all() as$country) {
/** @var \Farzai\Geonames\Entities\CountryEntity $country */echo$country->name;
}
Alternate country codes, comma separated, ISO-3166 2-letter country code, 60 characters
TH
No
admin1_code
string
Fipscode (subject to change to iso code), see exceptions below, see file admin1Codes.txt for display names of this code; varchar(20)
40
No
admin2_code
string
Code for the second administrative division, a county in the US, see file admin2Codes.txt; varchar(80)
40
No
admin3_code
string
Code for third level administrative division, varchar(20)
40
No
admin4_code
string
Code for fourth level administrative division, varchar(20)
40
No
population
int
Bigint (8 byte int)
0
No
elevation
int
In meters
0
No
dem
int
Digital elevation model, srtm3 or gtopo30, average elevation of 3''x3'' (ca 90mx90m) or 30''x30'' (ca 900mx900m) area in meters, integer. srtm processed by cgiar/ciat.
0
No
timezone
string
The iana timezone id (see file timeZone.txt) varchar(40)
iso 639 language code 2- or 3-characters; 4-characters 'post' for postal codes and 'iata','icao' and faac for airport codes, fr_1793 for French Revolution names, abbr for abbreviation, link to a website (mostly to wikipedia), wkdt for the wikidataid
en
Yes
name
string
alternate name or name variant
Ban Khlong Nung
Yes
is_preferred_name
bool
true, if this alternate name is an official/preferred name
true
Yes
is_short_name
bool
true, if this is a short name like 'California' for 'State of California'
true
Yes
is_colloquial
bool
true, if this alternate name is a colloquial or slang term. Example: 'Big Apple' for 'New York'.
true
Yes
is_historic
bool
true, if this alternate name is historic and was used in the past.
true
Yes
from
string
from period when the name was used
2011-03-03
No
to
string
to period when the name was used
2011-03-03
No
License
The MIT License (MIT). Please see License File for more information.