2017 © Pedro Peláez
 

library country-codes

CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country

image

thalidzhokov/country-codes

CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country

  • Monday, May 28, 2018
  • by thalidzhokov
  • Repository
  • 3 Watchers
  • 1 Stars
  • 897 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 1096 % Grown

The README.md

PHP Class CountryCodes

CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country, (*1)

  1. alpha2 ISO-3166-1 alpha-2 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
  2. alpha3 ISO-3166-1 alpha-3 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
  3. numeric ISO-3166-1 numeric https://en.wikipedia.org/wiki/ISO_3166-1_numeric
  4. isd Internatiguonal Subscriber Dialing code https://en.wikipedia.org/wiki/List_of_country_calling_codes
  5. continentCode Continent Code
  6. continent Continent Name
  7. country Country Name
  8. countryFull Country Full Name
  9. emoji Emoji Flag http://unicode.org/emoji/charts/emoji-ordering.html#country-flag

Installation

Install via Composer, (*2)

composer require thalidzhokov/country-codes

OR include CountryCodes.php in your PHP code, (*3)

require_once('CountryCodes.php');

Usage

Change default language

\CountryCodes::$language = 'ru';

Method get()

Get array key => value, (*4)

\CountryCodes::get('alpha2', 'country');

Return, (*5)

array (
  'AB' => 'Abkhazia',
  'AD' => 'Andorra',
  ...,
  'AI' => 'Anguilla',
  'AL' => 'Albania',
  'AM' => 'Armenia',
  ...,
  'US' => 'USA',
  ...
)

Method get2()

Get array with multiple values key => [value1, value2, ...], (*6)

\CountryCodes::get2('alpha3', ['alpha2', 'continentCode', 'emoji']);

Return, (*7)

array (
  'ABH' => 
  array (
    'alpha2' => 'AB',
    'continentCode' => 'AS',
    'emoji' => '',
  ),
  'AND' => 
  array (
    'alpha2' => 'AD',
    'continentCode' => 'EU',
    'emoji' => '🇦🇩',
  ),
  'ARE' => 
  array (
    'alpha2' => 'AE',
    'continentCode' => 'AS',
    'emoji' => '🇦🇪',
  ),
  ...
)

Method getByContinent()

Get array key => value by continent, (*8)

\CountryCodes::getByContinent('alpha3', 'countryFull', 'EU');

Return, (*9)

array (
  ...,
  'BEL' => 'Belgium',
  'BGR' => 'Bulgaria',
  'BLR' => 'Belarus',
  'CHE' => 'Swiss Confederation',
  'CZE' => 'Czech Republic',
  'DEU' => 'Germany',
  ...
)

Method getEmojiByAlpha2()

Get emoji flag code by alpha2, (*10)

\CountryCodes::getEmojiByAlpha2('ZW');

Return, (*11)

🇿🇼

Method getEmojiByAlpha3()

Get emoji flag code by aplha3, (*12)

\CountryCodes::getEmojiByAlpha3('ZMB');

Return, (*13)

🇿🇲

The Versions

28/05 2018

dev-master

9999999-dev

CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country

  Sources   Download

GNU General Public License v3.0 GPL-3.0-or-later

The Requires

  • php ^5.6 || ^7.0

 

by Albert Thalidzhokov

iso 3166 numeric country codes alpha-2 alpha-3 international organization for standardization iso-3166-1 isd internatiguonal subscriber dialing idd international direct dialing country calling codes country dial in codes

28/05 2018

1.0.2

1.0.2.0

CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^5.6 || ^7.0

 

by Albert Thalidzhokov

iso 3166 numeric country codes alpha-2 alpha-3 international organization for standardization iso-3166-1 isd internatiguonal subscriber dialing idd international direct dialing country calling codes country dial in codes

27/10 2017

1.0.1

1.0.1.0

CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country

  Sources   Download

GNU General Public License v3.0

The Requires

  • php ^5.6 || ^7.0

 

by Albert Thalidzhokov

iso 3166 numeric country codes alpha-2 alpha-3 international organization for standardization iso-3166-1 isd internatiguonal subscriber dialing idd international direct dialing country calling codes country dial in codes