Browser, Operating System (OS), Device, and Language Detection PHP Library
Browser, Operating System (OS), Device, and Language Detection PHP Library
Detecting the user's browser, operating system, device and language from PHP. Because browser detection is not always reliable and evolves at all time, use with care and feel free to contribute.
This library uses PHP 5.3+.
It is recommended that you install the PHP Browser library through composer. To do so, run the following command:
composer require sinergi/browser-detectorThe Browser class allows you to detect a user's browser and version.
use Sinergi\BrowserDetector\Browser;
$browser = new Browser();
if ($browser->getName() === Browser::IE && $browser->getVersion() getName() === Browser::IE && $browser->isCompatibilityMode()) {
$browser->endCompatibilityMode();
}The OS class allows you to detect a user's operating system and version.
use Sinergi\BrowserDetector\Os;
$os = new Os();
if ($os->getName() === Os::IOS) {
echo 'You are using an iOS device.';
}The Device class allows you to detect a user's device.
use Sinergi\BrowserDetector\Device;
$device = new Device();
if ($device->getName() === Device::IPAD) {
echo 'You are using an iPad.';
}The Language class allows you to detect a user's language.
use Sinergi\BrowserDetector\Language;
$language = new Language();
if ($language->getLanguage() === 'de') {
echo 'Get this website in german.';
}PHP Browser is licensed under The MIT License (MIT).
No open issues yet, or sync has not completed.