PHP code example of ishdidev / country

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

    

ishdidev / country example snippets


$country = new Country();

//List all countries
$countryList = $country->getCountries();

//Get Data
$countryName = $country->getData('IN', Country::COUNTRY_NAME);

$countryCode = $country->getData('India', Country::COUNTRY_CODE);

$phoneCode = $country->getData('IN', Country::COUNTRY_PHONE);

$countryState = $country->getData('IN', Country::COUNTRY_STATE);

$countryLanguages = $country->getData('IN', Country::COUNTRY_LANGUAGE_ALL);

$countryLanguage = $country->getData('IN', Country::COUNTRY_LANGUAGE_MAIN);

$countryContinent = $country->getData('IN', Country::COUNTRY_CONTINENT);

$countryCurrency = $country->getData('IN', Country::COUNTRY_CURRENCY);

$countryCapital = $country->getData('IN', Country::COUNTRY_CAPITAL);

//List all languages

$language = new Language();

$languageList = $language->list();

//List all currencies

$currency = new Currency();

$currencyList = $currency->list();

//List all continents

$continentList = $country->listContinent();