Skip to content

Repository files navigation

ISO-639

Latest Version MIT License Offset Earth Larabelles

GitHub Workflow Status StyleCI Total Downloads

A PHP library providing ISO 639-1 data.

Installing

composer require astrotomic/iso639

Usage

use Astrotomic\ISO639\ISO639;

$iso639 = new ISO639();

// dataset methods
$iso639->count();
$iso639->all();
$iso639->all(ISO639::KEY_639_1);
$iso639->iterator(ISO639::KEY_639_1);

// language retriever
$iso639->name('German');
$iso639->alpha2('de');

// ISO specific methods
$iso639->iso639_1('de');
$iso639->iso639_2B('ger');
$iso639->iso639_2T('deu');

// names localized by any ICU locale
$iso639->name('Deutsch');
$iso639->name('allemand');

// aliases map to ISO 639-1 codes
$iso639 = new ISO639(null, [
    'German language' => 'de',
]);
$iso639->name('German language');

// resolve any supported name or code, throwing exception when unknown
$iso639->find('Deutsch');
$iso639->find('de');
$iso639->find('ger');
$iso639->find('unknown'); // OutOfBoundsException

About

A PHP library providing ISO 639-1 data.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Contributors

Languages