A PHP library to work with localized country names

1.0.0 2016-11-21 15:09 UTC

This package is auto-updated.

Last update: 2021-10-12 21:41:28 UTC



  • Understand a lot of languages (almost 150 - but some language may not be complete).
  • Works with PHP 5.3+
  • Requires the mb_string PHP extension (or any package that implements mb_strtolower for UTF-8)


With composer

composer require mlocati/countrynames

Without composer


require_once 'autoload.php';

Sample usage

use MLocati\CountryNames\CountryList;

require_once 'autoload.php'; // Not required if you use composer

$italianList = new CountryList('it');
$italianCountry = $italianList->getCountryByName('italia');

$englishList = new CountryList('en');
$englishCountry = $englishList->getCountryByCode($italianCountry->getCode());

echo $englishCountry->getCanonicalName(); // Dumps 'Italy'