umpirsky / country-list

:globe_with_meridians: List of all countries with names and ISO 3166-1 codes in all languages and data formats.
MIT License
5.16k stars 1.55k forks source link

How is one supposed to use it? #27

Closed linuxd3v closed 9 years ago

linuxd3v commented 10 years ago

How is one supposed to use it?
Do I just include php file with countries manually? Is there any kind of public access class?

This is certainly not a correct way?:

$countriesFile = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'umpirsky' . DIRECTORY_SEPARATOR . 'country-list' . DIRECTORY_SEPARATOR . 'country' . DIRECTORY_SEPARATOR . 'cldr' . DIRECTORY_SEPARATOR . 'en_US' . DIRECTORY_SEPARATOR . 'country.php');
$countries = include($countriesFile);
umpirsky commented 10 years ago

You can install it via composer or do it like in https://github.com/umpirsky/country-list/blob/master/src/Umpirsky/Country/Importer/Source/Icu.php in your code if you already want to do it programatically.