deft/iso3166-utility

Library to convert ISO3166 alpha-2 country codes to their alpha-3 counterpart and vice versa.

Installs: 15 899

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/deft/iso3166-utility

1.0.0 2014-06-10 06:38 UTC

This package is auto-updated.

Last update: 2025-10-05 01:34:47 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');