deft / iso3166-utility
Library to convert ISO3166 alpha-2 country codes to their alpha-3 counterpart and vice versa.
Installs: 15 849
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 1
Open Issues: 0
This package is auto-updated.
Last update: 2024-11-04 23:16:56 UTC
README
Library to convert ISO3166 alpha-2 country codes to their alpha-3 counterpart and vice versa.
Usage
<?php $util = new Deft\ISO3166\CountryCodeUtility(); print $util->convertAlpha2ToAlpha3('NL'); // Outputs 'NLD' print $util->convertAlpha3ToAlpha2('NLD'); // Outputs 'NL'; // Converting non-existing country codes will result in null $util->convertAlpha3ToAlpha2('FOO'); // Returns null // You can provide a custom country code list by passing the path as the first // constructor argument. The file should be tab separated ("NL\tNLD\n") $utilCustom = new Deft\ISO3166\CountryCodeUtility('custom_country_code_list.txt');