1. Go to this page and download the library: Download one23/iso639 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
one23 / iso639 example snippets
use \One23\Iso639\Code1;
use \One23\Iso639\Code2b;
use \One23\Iso639\Code2t;
use \One23\Iso639\Code3;
// or
//use \One23\Iso639\Code3Min as Code3;
(string)Code1::from('en')->code3(); // => 'eng'
(string)Code1::from('uk')->getNameNative(); // => 'українська мова'
(string)Code1::from('jv')->getName(); // => 'Javanese'
(string)Code2t::from('eng')->getName(); // => 'English'
(string)Code2t::from('ind')->getNameNative(); // => 'Bahasa Indonesia'
(string)Code2t::from('jav')->code1(); // => 'jv'
use \One23\Iso639\Code1 as Code;
// or
//use \One23\Iso639\Code2b as Code;
// or
//use \One23\Iso639\Code2t as Code;
$code = Code::from('en');
(string)$code; // => 'en'
// or
$code->getCode(); // => 'en'
// or
$code->toString(); // => 'en'
$code->getName(); // => 'English'
$code->toArray();
// => "{"iso_639_1_code":"en","iso_639_1_name":"English","iso_639_1_native":"English","iso_639_1_notes":null,"iso_639_1_family":"Indo-European","is_ancient":false,"is_macrolanguage":false,"macrolanguages":[],"iso_639_2_t_code":"eng","iso_639_2_t_name":"English","iso_639_2_b_code":"eng","iso_639_2_b_name":"English","iso_639_3_code":"eng","iso_639_6_code":"engs"}
$code1 = Code2b::from('ara')->code1();
$macrolanguages = $code1->macrolanguages();
array_keys($macrolanguages); // => ["aao","abh","abv","acm","acq",...]
reset($macrolanguages); // Code3Macro
Code1::all(); // => ["ab","aa","af","ak",...]
Code2b::all(); // => ["abk","aar","afr","aka","alb","amh",...]
Code2t::all(); // => ["abk","aar","afr","aka","sqi","amh","ara","arg",...]
use \One23\Iso639\Code3;
// or
//use \One23\Iso639\Code3All as Code3;
$code3 = Code3::from('ful');
(string)$code3; // => 'ful'
// or
$code3->getCode(); // => 'ful'
// or
$code3->toString(); // => 'ful'
$code3->getName(); // => 'Fulah'
$code3->toArray();
// => {"iso_639_3_code":"ful","iso_639_3_name":"Fulah","iso_639_3_name_inverted":"Fulah","iso_639_3_scope":"M","iso_639_3_type":"L","iso_639_3_notes":null,"iso_639_1_code":"ff","iso_639_2_b_code":"ful","iso_639_2_t_code":"ful","iso_639_3_merge":null,"iso_639_3_merge_reason":null,"iso_639_3_merge_date":null}
$code3 = Code3All::from('xrq');
/** @var Code3All|null $merge **/
$merge = $code3->merge()
if ($merge) {
$merge->toArray();
// => {"iso_639_3_code":"dmw","iso_639_3_name":"Mudburra","iso_639_3_name_inverted":"Mudburra","iso_639_3_scope":"I","iso_639_3_type":"L","iso_639_3_notes":null,"iso_639_1_code":null,"iso_639_2_b_code":null,"iso_639_2_t_code":null,"iso_639_3_merge":null,"iso_639_3_merge_reason":null,"iso_639_3_merge_date":null}
}
Code3::all(); // => ["aka","ara","aym","aze","bal",...]