gmo / iso-639
Convert between ISO-639 codes
Installs: 67 731
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 9
Forks: 5
Open Issues: 1
Requires
- php: >=5.3
This package is not auto-updated.
Last update: 2024-11-05 04:32:35 UTC
README
Install with composer:
composer require "gmo/iso-639:^1.0"
Usage
Initialize the Languages
class, then find a Language
by one of its properties.
use Gmo\Iso639\Languages; $languages = new Languages(); $english = $languages->findByName('English'); echo $english->code1(); // en echo $english->code2t(); // eng echo $english->code2b(); // eng echo $english->code3(); // eng echo $english->name(); // English
Converting ISO 639-3 codes to ISO 639-1 codes:
$languages->findByCode3('eng')->code1(); // en
Or reverse:
$languages->findByCode1('en')->code3(); // eng
Languages
can be iterated:
foreach ($languages as $language) { echo $language->name(); }
Or a list can be retrieved:
$languages->getLanguages();