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
availablewithin the code. -
The
getClosestLanguagefunction works similarly togetLanguage, but it doesn't guarantee a 100% correct result. For instance, the exampleÄpfel straße délicieuxwould returninvalid_languagewithgetLanguage, whilegetClosestLanguagewould returnde, based on which language had the most character matches. For instance, the expressiondélicieux délicieux Äpfelwould have also returnedfr. -
To search only in the desired languages,
checkListis used. -
To prevent searching in unwanted languages,
blockListis used. - To retrieve the
lowercaseversion of the given string for each language,getLowerCaseis used. Separate definitions for each language are required.
Testing
vendor/bin/phpunit tests/Test.php