PHP code example of aozen / language-detector

1. Go to this page and download the library: Download aozen/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/ */

    

aozen / language-detector example snippets


    use \Aozen\LanguageDetector\LanguageDetector;

class YourClass {
    public function yourFunction() {
        $language_detector = new LanguageDetector();
        return $language_detector->detect("Güneş")->getLanguage(); // Result: "tr"
    }
}

    $language_detector->detect("Äpfel")->checkList("tr", "de", "it")->getLanguage(); // de

    $language_detector->detect("Äpfel")->blockList("de")->getLanguage(); // invalid_language

    $language_detector->detect("TÜRKÇE-BİR-YAZI")->getLowerCase(); // türkçe-bi̇r-yazı