lasserafn / php-string-script-language
Detect language/encoding of a string in PHP
Installs: 3 045 023
Dependents: 2
Suggesters: 0
Security: 0
Stars: 22
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: ^5.6|^7.0|^7.1|^8.0|^8.1|^8.2
Requires (Dev)
- doctrine/instantiator: 1.0.5
- phpunit/phpunit: ^5.6
- phpunit/phpunit-mock-objects: 3.2.4
- satooshi/php-coveralls: ^1.0
- sebastian/exporter: ^1.2
This package is auto-updated.
Last update: 2024-10-26 09:49:08 UTC
README
Detect if a string contains different language scripts with a simple API.
Installation
You just require using composer and you're good to go!
composer require lasserafn/php-string-script-language
Usage
As with installation, usage is quite simple:
use LasseRafn\StringScript; StringScript::isThai('Hello world.'); // false StringScript::isChinese('你好世界。'); // true
All methods return a boolean value.
Supported scripts
- Common
- Arabic
- Armenian
- Bengali
- Bopomofo
- Braille
- Buhid
- Canadian Aboriginal
- Cherokee
- Cyrillic
- Devanagari
- Ethiopic
- Georgian
- Greek
- Gujarati
- Gurmukhi
- Han
- Hangul
- Hanunoo
- Hebrew
- Hiragana
- Inherited
- Kannada
- Katakana
- Khmer
- Lao
- Latin
- Limbu
- Malayalam
- Mongolian
- Myanmar
- Ogham
- Oriya
- Runic
- Sinhala
- Syriac
- Tagalog
- Tagbanwa
- TaiLe
- Tamil
- Telugu
- Thaana
- Thai
- Tibetan
- Yi
- Chinese (Helper for Han)
- Japanese (Helper for Hiragana or Katakana)
All methods
StringScript::isCommon($string);
StringScript::isArabic($string);
StringScript::isArmenian($string);
StringScript::isBengali($string);
StringScript::isBopomofo($string);
StringScript::isBraille($string);
StringScript::isBuhid($string);
StringScript::isCanadian_Aboriginal($string);
StringScript::isCherokee($string);
StringScript::isCyrillic($string);
StringScript::isDevanagari($string);
StringScript::isEthiopic($string);
StringScript::isGeorgian($string);
StringScript::isGreek($string);
StringScript::isGujarati($string);
StringScript::isGurmukhi($string);
StringScript::isHan($string);
StringScript::isHangul($string);
StringScript::isHanunoo($string);
StringScript::isHebrew($string);
StringScript::isHiragana($string);
StringScript::isInherited($string);
StringScript::isKannada($string);
StringScript::isKatakana($string);
StringScript::isKhmer($string);
StringScript::isLao($string);
StringScript::isLatin($string);
StringScript::isLimbu($string);
StringScript::isMalayalam($string);
StringScript::isMongolian($string);
StringScript::isMyanmar($string);
StringScript::isOgham($string);
StringScript::isOriya($string);
StringScript::isRunic($string);
StringScript::isSinhala($string);
StringScript::isSyriac($string);
StringScript::isTagalog($string);
StringScript::isTagbanwa($string);
StringScript::isTaiLe($string);
StringScript::isTamil($string);
StringScript::isTelugu($string);
StringScript::isThaana($string);
StringScript::isThai($string);
StringScript::isTibetan($string);
StringScript::isYi($string);
StringScript::isChinese($string);
StringScript::isJapanese($string);
Requirements
- PHP 5.6, 7.0 or 7.1