1. Go to this page and download the library: Download chibifr/language-detector 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/ */
chibifr / language-detector example snippets
// Your file should simple return an array of words/characters.
return [
'word1',
'word2',
'word3',
'word4',
'etc'
];
// Require the composer's vendor autoload file
new Converter object
$lg = new Detector();
// Trying to detect English
$result = $lg->detectLanguage('Hello, my name is FooBar and I live in New York. The weather here is pretty
nice! Anyways, have a good day, people.');
print_r($result) // Will print ['language' => 'english', 'reliable' => 1]
// Trying to detect an unkown language
$result = $lg->detectLanguage('A e i o u.');
print_r($result) // Will print ['language' => 'english', 'reliable' => 0]
// You can then check if the language found is reliable before doing more.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.