rkr / countries
A library to help translating country-names into various standards and to text
Installs: 3 203
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >= 7.0
Requires (Dev)
- phpstan/phpstan: >= 0.1
- phpunit/phpunit: >= 3.7@stable
README
The country-codes are copied from umpirsky/country-list. I've only added some code-locators and some translators and removed all those formats not suited for my needs.
Some examples
Get all countries
$provider = new IcuCountryListProvider('en', 'GB'); print_r($provider->getCountries());
Array
(
[AF] => Afghanistan
[AX] => Ă…land Islands
[AL] => Albania
[DZ] => Algeria
[AS] => American Samoa
[AD] => Andorra
[AO] => Angola
[AI] => Anguilla
(248 more ...)
)
Get the name of a specific country
$provider = new IcuCountryNameLocator('en', 'GB'); echo $provider->getCountry('DE');
Germany
Get all EU-countries:
$provider = new EuCountryProvider('en', 'GB'); print_r($provider->getList());
Array
(
[BE] => Belgium
[BG] => Bulgaria
[CZ] => Czech Republic
[DK] => Denmark
[DE] => Germany
[EE] => Estonia
[IE] => Ireland
(22 more ...)
)