Fam UserAgentParser is a lightweight and fast browser detector. It determines the operating system, web client name and web client version.
You can install Fam UserAgentParser with composer. To install Fam UserAgentParser with composer just execute the following command:
composer require fam/util-useragentparser
$userAgent = UserAgentParser::createInstance()->parseUserAgent($_SERVER['HTTP_USER_AGENT']);
if ($userAgent->isWebClient('firefox')) {
if ($userAgent->isWebClientVersionBetween(9.5, 9.6)) {
echo 'firefox between 95 and 96';
}
else if ($userAgent->isWebClientVersionBetween(9.2, 9.4)) {
echo 'firefox between 92 and 94';
}
}
if ($userAgent->isOs('macintosh')) {
echo 'Mac';
}