PHP code example of leodido / langcode-conv

1. Go to this page and download the library: Download leodido/langcode-conv 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/ */

    

leodido / langcode-conv example snippets


use Conversio\Conversion;
use Conversio\Adapter\LanguageCode;
use Conversio\Adapter\Options\LanguageCode;
// ...
$adapter = new LanguageCode();
$options = new LanguageCodeOptions();

$converter = new Conversion($adapter);
$converter->setAdapterOptions($options);

$converter = new Conversion(['adapter' => $adapter, 'options' => $options]);

$options->setOutput('native');
// ISO 639-1 => NATIVE
$converter->filter('it'); // italiano

// ISO 639-2/T => NATIVE
$converter->filter('vie'); // tiếng việt
$converter->filter('tam'); // தமிழ்
// ISO 639-3 => NATIVE
$converter->filter('yid + 2'); // ייִדיש
// ISO 639-3 => NAME
$options->setOutput('name');
$converter->filter('vie'); // vietnamese
$converter->filter('tam'); // tamil
$converter->filter('yid + 2'); // yiddish