Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matriphe/php-iso-639
PHP library to convert ISO-639-1 code to language name, based on Wikipedia's List of ISO 639-1 codes
https://github.com/matriphe/php-iso-639
hactoberfest iso639 iso639-1
Last synced: 3 days ago
JSON representation
PHP library to convert ISO-639-1 code to language name, based on Wikipedia's List of ISO 639-1 codes
- Host: GitHub
- URL: https://github.com/matriphe/php-iso-639
- Owner: matriphe
- Created: 2015-06-25T19:55:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-17T22:45:30.000Z (10 months ago)
- Last Synced: 2024-10-30T08:03:22.664Z (2 months ago)
- Topics: hactoberfest, iso639, iso639-1
- Language: PHP
- Homepage:
- Size: 55.7 KB
- Stars: 50
- Watchers: 2
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP ISO-639
[![Run Test](https://github.com/matriphe/php-iso-639/actions/workflows/test-pipeline.yml/badge.svg?branch=master)](https://github.com/matriphe/php-iso-639/actions/workflows/test-pipeline.yml)
[![Total Download](https://img.shields.io/packagist/dt/matriphe/iso-639.svg)](https://packagist.org/packages/matriphe/iso-639)
[![Latest Stable Version](https://img.shields.io/packagist/v/matriphe/iso-639.svg)](https://packagist.org/packages/matriphe/iso-639)PHP library to convert ISO-639-1 code to language name, based on Wikipedia's [List of ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
## Installation
For PHP 8.1 or latest:
```shell
composer require matriphe/iso-639
```For older PHP version:
```shell
composer require matriphe/iso-639:1.3
```## Usage Example
```php
languageByCode1('en'); // English
echo $iso->languageByCode1('id'); // Indonesian
echo $iso->languageByCode1('jv'); // Javanese// Get native language name from ISO-639-1 code
echo $iso->nativeByCode1('en'); // English
echo $iso->nativeByCode1('id'); // Bahasa Indonesia
echo $iso->nativeByCode1('jv'); // basa Jawa// Get language name from ISO-639-2t code
echo $iso->languageByCode2t('eng'); // English
echo $iso->languageByCode2t('ind'); // Indonesian
echo $iso->languageByCode2t('jav'); // Javanese// Get native language name from ISO-639-2t code
echo $iso->nativeByCode2t('eng'); // English
echo $iso->nativeByCode2t('ind'); // Bahasa Indonesia
echo $iso->nativeByCode2t('jav'); // basa Jawa// Get language name from ISO-639-2b code
echo $iso->languageByCode2b('eng'); // English
echo $iso->languageByCode2b('ind'); // Indonesian
echo $iso->languageByCode2b('jav'); // Javanese// Get native language name from ISO-639-2b code
echo $iso->nativeByCode2b('eng'); // English
echo $iso->nativeByCode2b('ind'); // Bahasa Indonesia
echo $iso->nativeByCode2b('jav'); // basa Jawa// Get language name from ISO-639-3 code
echo $iso->languageByCode3('eng'); // English
echo $iso->languageByCode3('ind'); // Indonesian
echo $iso->languageByCode3('jav'); // Javanese// Get native language name from ISO-639-3 code
echo $iso->nativeByCode3('eng'); // English
echo $iso->nativeByCode3('ind'); // Bahasa Indonesia
echo $iso->nativeByCode3('jav'); // basa Jawa// Get language array from ISO-639-2b code
echo $iso->getLanguageByIsoCode2b('eng'); // ['en', 'eng', 'eng', 'eng', 'English', 'English']
echo $iso->getLanguageByIsoCode2b('ind'); // ['id', 'ind', 'ind', 'ind', 'Indonesian', 'Bahasa Indonesia']
echo $iso->getLanguageByIsoCode2b('jav'); // ['jv', 'jav', 'jav', 'jav', 'Javanese', 'basa Jawa']
```## To Do
* Convert language name to ISO-639 code