PHP code example of woutersioen / country-list

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

    

woutersioen / country-list example snippets


// update this to the path to the "vendor/" directory, relative to this file

// fetch an array of countries in a language
$languages = $this->getContainer()->get('countries')->getForLanguage('en');

// fetch one country in a language
$language = $this->getContainer()->get('countries')->getSpecificForLanguage('be', 'en');
// returns 'Belgium'

use Sioen\Countries;

// fetch an array of countries in a language
$languages = (new Countries)->getForLanguage('en');

// fetch one country in a language
$language = (new Countries)->getSpecificForLanguage('be', 'en');
// returns 'Belgium'

use Sioen\ContryList;

$countries = new Countries();

// fetch an array of countries in a language
$languages = $countries->getForLanguage('en');

// fetch one country in a language
$language = $countries->getSpecificForLanguage('be', 'en');
// returns 'Belgium'