PHP code example of nazariitsubera / country-aliases

1. Go to this page and download the library: Download nazariitsubera/country-aliases library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nazariitsubera / country-aliases example snippets


use CountryAliases\CountryAliasResolver;

$resolver = new CountryAliasResolver(__DIR__ . '/data/country_aliases.json');

var_dump($resolver->lookup('United States of America')); // "US"
var_dump($resolver->lookup('   republic   of   ireland  ')); // "IE"