menarasolutions/geographer – php библиотека стран и городов на разных языках

use MenaraSolutions\\Geographer\\Earth;
use MenaraSolutions\\Geographer\\Country;

// Default entry point is our beautiful planet
$earth = new Earth();

// Give me a list of all countries please

// Oh, but please try to use short versions, eg. USA instead of United States of America

// Now please give me all states of Thailand
$thailand = $earth->getCountries()->findOne(['code' => 'TH']); // You can call find on collection
$thailand = $earth->findOne(['code' => 'TH']); // Or right away on division
$thailand = $earth->findOneByCode('TH'); // Alternative shorter syntax
$thailand = Country::build('TH'); // You can build a country object directly, too

// Oh, but I want them in Russian

// Oh, but I want them inflicted to 'in' form (eg. 'in Spain')

// Or if you prefer constants for the sake of IDE auto-complete

// What's the capital and do you have a geonames ID for that? Or maybe latitude and longitude?
$capital = $thailand->getCapital();

Оставить комментарий

Ваш электронный адрес не будет опубликован. Обязательные поля помечены *