PHP code example of josantonius / languagecode

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

    

josantonius / languagecode example snippets


public static function all(): array;

public static function getCode(string $languageName): string|null;

public static function getName(string $languageCode): string|null;

public static function all(): array

public static function getCode(string $languageName): string|null

public static function getName(string $languageCode): string|null

use Josantonius\LanguageCode\LanguageCode;

$languageCode = new LanguageCode();

$languageCode->all();

use Josantonius\LanguageCode\LanguageCodeCollection;

LanguageCodeCollection::all();

[
    'aa' => 'Afar',
    'ab' => 'Abkhazian',
    'af' => 'Afrikaans',
    'am' => 'Amharic',
    'ar' => 'Arabic',
    'ar-ae' => 'Arabic (U.A.E.)',
    'ar-bh' => 'Arabic (Bahrain)',
    'ar-dz' => 'Arabic (Algeria)',
    'ar-eg' => 'Arabic (Egypt)',
    'ar-iq' => 'Arabic (Iraq)',
    (...)
]

use Josantonius\LanguageCode\LanguageCode;

$languageCode = new LanguageCode();

$languageCode->getCode('Spanish'); // es

use Josantonius\LanguageCode\LanguageCodeCollection;

LanguageCodeCollection::getCode('Turkish'); // tr

use Josantonius\LanguageCode\LanguageCode;

$languageCode = new LanguageCode();

$languageCode->getName('eo'); // Esperanto

use Josantonius\LanguageCode\LanguageCodeCollection;

LanguageCodeCollection::getName('de'); // German