deft / iso3166-utility
Library to convert ISO3166 alpha-2 country codes to their alpha-3 counterpart and vice versa.
1.0.0
2014-06-10 06:38 UTC
This package is auto-updated.
Last update: 2026-03-05 02:25:58 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');