Giter VIP home page Giter VIP logo

iriven / worldcountriesdatas Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 67 KB

All useful information about every country packaged as convenient little country objects. It includes data from ISO 3166 (countries and states/subdivisions ), ISO 4217 (currency), and E.164 (phone numbers).

License: MIT License

PHP 100.00%
countries region countries-infos country-objects phone-number currency convenient sub-regions phone-code subdivision

worldcountriesdatas's Introduction

PHP Countries Data Provider Class

Donate

All useful information about every country packaged as convenient little country objects. It includes data from ISO 3166 (countries and states/subdivisions ), ISO 4217 (currency), and E.164 (phone numbers).

  • Initialisation
       $myObject = new \Iriven\WorldCountriesDatas();    
* Retrieve datas for given country ISO-3166-2 , ISO-3166-3 or numeric code.
      Example:  For France.
      $myObject->getCountryInfos('fr');
      $myObject->getCountryInfos('fr', true);
      $myObject->getCountryInfos('FR');
      $myObject->getCountryInfos('fra');
      $myObject->getCountryInfos('FRA');
      $myObject->getCountryInfos('FRA', true);
      $myObject->getCountryInfos('250');
      $myObject->getCountryInfos('250', true);       
* Get country ISO-3166-2 code for given ISO-3166-3 or numeric code
     Example:  For France
     $myObject->getCountryAlpha2Code('fra');
     $myObject->getCountryAlpha2Code('FRA');
     $myObject->getCountryAlpha2Code('250');   
* Get country ISO-3166-3 code for given ISO-3166-2 or numeric code
     Example:  For France
     $myObject->getCountryAlpha3Code('fr');
     $myObject->getCountryAlpha3Code('FR');
     $myObject->getCountryAlpha3Code('250');     
* Get country numeric code for given ISO-3166-2 or ISO-3166-3 code
     Example:  For France
     $myObject->getCountryNumericCode('fra');
     $myObject->getCountryNumericCode('FRA');
     $myObject->getCountryNumericCode('fr');
     $myObject->getCountryNumericCode('FR');   
* Get country Currency Code from given alpha-2, alpha-3 or numeric code
  	Example:  For France
  	$myObject->getCountryCurrencyCode('fra');
  	$myObject->getCountryCurrencyCode('fr');
  	$myObject->getCountryCurrencyCode('250');        
* Get country Currency Name from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryCurrencyName('fra');
      $myObject->getCountryCurrencyName('fr');
      $myObject->getCountryCurrencyName('250');       
* Get country Phone Code (ISD) from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryPhoneCode('fra');
      $myObject->getCountryPhoneCode('fr');
      $myObject->getCountryPhoneCode('250');          
* Get country Name from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryName('fra');
      $myObject->getCountryName('fr');
      $myObject->getCountryName('250');
* Get Country Capital name from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryCapitalName('fra');
      $myObject->getCountryCapitalName('fr');
      $myObject->getCountryCapitalName('250');     
* Get the Top Level Domain(TLD) of a Country from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryDomain('fra');
      $myObject->getCountryDomain('fr');
      $myObject->getCountryDomain('250');    
* Get Country two letters Continent code from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryRegionAlphaCode('fra');
      $myObject->getCountryRegionAlphaCode('fr');
      $myObject->getCountryRegionAlphaCode('250');       
* Get Country Continent ISO code from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryRegionNumCode('fra');
      $myObject->getCountryRegionNumCode('fr');
      $myObject->getCountryRegionNumCode('250');     
* Get Country Continent Name from given alpha-2, alpha-3 or numeric code
      Example:  For France
      $myObject->getCountryRegionName('fra');
      $myObject->getCountryRegionName('fr');
      $myObject->getCountryRegionName('250');
* Get Country Sub-region ISO code from given alpha-2, alpha-3 or numeric code
 	Example:  For France
 	$myObject->getCountrySubRegionCode('fra');
 	$myObject->getCountrySubRegionCode('fr');
 	$myObject->getCountrySubRegionCode('250');          
* Get Country Sub-region name from given alpha-2, alpha-3 or numeric code
 	Example:  For France
 	$myObject->getCountrySubRegionName('fra');
 	$myObject->getCountrySubRegionName('fr');
 	$myObject->getCountrySubRegionName('250');
* Get Languages (code) spoken in a Country from given alpha-2, alpha-3 or numeric code
 	Example:  For France
 	$myObject->getCountryLanguage('fra');
 	$myObject->getCountryLanguage('fr');
 	$myObject->getCountryLanguage('250');       
* Get a Country postal code Regex from given alpha-2, alpha-3 or numeric code
 	Example:  For France
 	$myObject->getCountryPostalCodePattern('fra');
 	$myObject->getCountryPostalCodePattern('fr');
 	$myObject->getCountryPostalCodePattern('250');
* Get an associative array of ISO-2, ISO-3 or numeric list of countries
     Example:  
     $myObject->getAllCountriesCodeAndName($CodeFormat='alpha-2');
     $myObject->getAllCountriesCodeAndName($CodeFormat='alpha-3');
     $myObject->getAllCountriesCodeAndName($CodeFormat='numeric');
     $myObject->getAllCountriesCodeAndName(); //same as alpha-2 code format
* Get associative [$code=>$name] array of all Currencies (useful for forms)
 	$myObject->getAllCurrenciesCodeAndName();
* Get associative [$isocode=>$name] array of all Regions (useful for forms)
 	$myObject->getAllRegionsCodeAndName();
* Get associative array of all countries grouped by region
 	$myObject->getAllCountriesGroupedByRegions();

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Donate

worldcountriesdatas's People

Contributors

iriven avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.