2017 © Pedro Peláez
 

library country_code_converter

Convert country name to codes or vice-versa.

image

writecrow/country_code_converter

Convert country name to codes or vice-versa.

  • Friday, August 11, 2017
  • by writecrow
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Country Code Converter

Circle CI, (*1)

A PHP library for converting ISO country codes to names and vice-versa., (*2)

Country data was last updated on August 10, 2017, from https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements, (*3)

The library recognizes ISO 2-digit, 3-digit, and numeric codes., (*4)

Usage in an application

The included /demo/index.php file contains a generation form demo., (*5)

Make your code aware of the CountryCodeConverter class via your favorite method (e.g., use or require), (*6)

Then pass a country code or country name into the class:, (*7)

echo CountryCodeConverter::convert('AL');
// Will print 'Albania'

echo CountryCodeConverter::convert('ALB');
// Will print 'Albania'

echo CountryCodeConverter::convert('008');
// Will print 'Albania'

echo CountryCodeConverter::convert('Albania');
// Will print 'AL'

Explicitly requesting return format.

If you want a specific format returned, pass the desired format as a second parameter:, (*8)

echo CountryCodeConverter::convert('Albania', 'name');
// Will print 'Albania'

echo CountryCodeConverter::convert('Albania', 'two-digit');
// Will print 'AL'

echo CountryCodeConverter::convert('Albania', 'three-digit');
// Will print 'ALB'

echo CountryCodeConverter::convert('Albania', 'numeric');
// Will print '008'

The Versions

11/08 2017

dev-master

9999999-dev

Convert country name to codes or vice-versa.

  Sources   Download

MIT

The Development Requires