evdw/country-list

This library allow you to get countries names and ISO codes in all languages for php usage.

Maintainers

Details

github.com/EVDW/country-list

Source

Installs: 12 525

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1 546

2.1.0 2018-09-13 15:01 UTC

README

This library allow you to get countries names and ISO codes in all languages for php usage.

Installing

$ composer require evdw/country-list

Using

Get a country names list in a specific language:

use EVDW\CountriesFactory;

$countriesFactory = new CountriesFactory;
$countriesFactory->getCountries('fr'); // Return a countries array in french

Get a country iso code, by specifying the language in which the country is written:

use EVDW\CountriesFactory;

$countriesFactory = new CountriesFactory;
$countriesFactory->getIsoCode('fr', 'france'); // Return the french ISO code

If the locale or the country name do not exist, no errors are throw, it returns null or empty array.