Translated country helper for CodeIgniter 4.
This package provides:
- a translated country list
- country name lookup from ISO code
- a ready-to-use country dropdown helper
- list of all countries with names and ISO 3166-1 codes
composer require domprojects/codeigniter4-countryLoad the helper:
helper('country');Get the translated country list:
$countries = countryList();Translate an ISO code:
$name = countryIsoToName('fr');Render a dropdown:
echo countryDropdown('country', ['class' => 'form-select'], 'FR');countryList(): arraycountryIsoToName(string $iso): stringcountryDropdown(string $name, array|string $extra = '', array|string $selected = ''): string
The package currently includes translated country files for:
- English
- French
- German
The helper uses the current CodeIgniter locale automatically through lang().
Additional locales can be added over time.
src/
Helpers/
country_helper.php
Language/
<locale>/
Country.php
The language files are based on data from:
MIT