This is just very simple language detector by using $_SERVER['HTTP_ACCEPT_LANGUAGE']
.
The output will be standard ISO 639-1.
composer require nasution/lang-detector
require 'vendor/autoload.php';
use Nasution\LangDetector;
echo LangDetector::detect(); // Output: id, en, it, ja, my, ms.