Download the PHP package aozen/language-detector without Composer
On this page you can find all versions of the php package aozen/language-detector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aozen/language-detector
More information about aozen/language-detector
Files in aozen/language-detector
Package language-detector
Short Description This package provides a set of functions to detect and manipulate language-specific strings, including language detection, case conversion, and language-based filtering.
License MIT
Homepage https://github.com/aozen/language-detector
Informations about the package language-detector
Language Detector
Used to determine which language a given string belongs to.
Installation
You can install the package via composer:
composer require aozen/language-detector
Usage
The LanguageDetector class must be included by yourself.
Example:
Other Usage Examples
-
By default, the code searches in all languages specified as
available
within the code. -
The
getClosestLanguage
function works similarly togetLanguage
, but it doesn't guarantee a 100% correct result. For instance, the exampleÄpfel straße délicieux
would returninvalid_language
withgetLanguage
, whilegetClosestLanguage
would returnde
, based on which language had the most character matches. For instance, the expressiondélicieux délicieux Äpfel
would have also returnedfr
. -
To search only in the desired languages,
checkList
is used. -
To prevent searching in unwanted languages,
blockList
is used. - To retrieve the
lowercase
version of the given string for each language,getLowerCase
is used. Separate definitions for each language are required.
Testing
vendor/bin/phpunit tests/Test.php