PHP code example of datablock / countrycodes

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

    

datablock / countrycodes example snippets


new CountryCodes([?string $country=null]);

use \Datablock\CountryCodes\CountryCodes;
// ...
$countrycodes = new CountryCodes();
$countrycodes = new CountryCodes('FR');

$countrycodes->setCountry(string $country);

use \Datablock\CountryCodes\CountryCodes;
// ...
$countrycodes = new CountryCodes();
// ...
$countrycodes->setCountry('FR');

$countrycodes->getDatabase([?string $country=null]);

    use \Datablock\CountryCodes\CountryCodes;
    // ...
    $countrycodes = new CountryCodes();
    // ...
    $countrycodes->getDatabase();
    

    use \Datablock\CountryCodes\CountryCodes;
    // ...
    $countrycodes = new CountryCodes('FR');
    // ...
    $countrycodes->getDatabase();
    

    use \Datablock\CountryCodes\CountryCodes;
    // ...
    $countrycodes = new CountryCodes();
    // ...
    $countrycodes->setCountry('FR');
    // ...
    $countrycodes->getDatabase();
    

    use \Datablock\CountryCodes\CountryCodes;
    // ...
    $countrycodes = new CountryCodes();
    // ...
    $countrycodes->getDatabase('FR');
    

$countrycodes->getCountryName([?string $country=null]);

$countrycodes->getIso2([?string $country=null]);

$countrycodes->getIso3([?string $country=null]);

$countrycodes->getTld([?string $country=null]);

$countrycodes->getFips([?string $country=null]);

$countrycodes->getIsoNumeric([?string $country=null]);

$countrycodes->getGeonameId([?string $country=null]);

$countrycodes->getE164([?string $country=null]);

$countrycodes->getPhoneCode([?string $country=null]);

$countrycodes->getContinent([?string $country=null]);

$countrycodes->getCapital([?string $country=null]);

$countrycodes->getTimezone([?string $country=null]);

$countrycodes->getCurrency([?string $country=null]);

$countrycodes->getLanguageCodes([?string $country=null]);

$countrycodes->getLanguages([?string $country=null]);

$countrycodes->getArea([?string $country=null]);