PHP code example of brightnucleus / country-codes

1. Go to this page and download the library: Download brightnucleus/country-codes 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/ */

    

brightnucleus / country-codes example snippets




use BrightNucleus\CountryCodes\Country;

// Get the name from an ISO 3166 country code.
$name = Country::getNameFromCode( 'US' ); // Returns 'United States'.

// Get the ISO 3166 country code from a country name.
$code = Country::getCodeFromName( 'United States' ); // Returns 'US'.