Skip to content

Latest commit

 

History

History
executable file
·
100 lines (80 loc) · 1.68 KB

readme.md

File metadata and controls

executable file
·
100 lines (80 loc) · 1.68 KB

PHP Browser

Copyright 2013, Gabriel Bull, Licensed under the GNU GENERAL PUBLIC LICENSE.

This project is a fork of Chris Schuld's browser.php.

Detecting the user's browser, operating system and language from PHP. Because browser detection is not always reliable and evolves at all time, use with care and feel free to contribute.

Browser Detection

The Browser class allow you to detect a user's browser and version.

Browsers Detected

  • Opera
  • Opera Mini
  • WebTV
  • Internet Explorer
  • Pocket Internet Explorer
  • Konqueror
  • iCab
  • OmniWeb
  • Firebird
  • Firefox
  • Iceweasel
  • Shiretoko
  • Mozilla
  • Amaya
  • Lynx
  • Safari
  • iPhone
  • iPod
  • iPad
  • Chrome
  • Navigator
  • GoogleBot
  • Yahoo! Slurp
  • W3C Validator
  • BlackBerry
  • IceCat
  • Nokia S60 OSS Browser
  • Nokia Browser
  • MSN Browser
  • MSN Bot
  • Netscape Navigator
  • Galeon
  • NetPositive
  • Phoenix
  • SeaMonkey

Example

if (Browser\Browser::getBrowser() === Browser\Browser::IE && Browser\Browser::getVersion() < 8) {
	echo 'Please upgrade your browser.';
}

OS Detection

The OS class allow you to detect a user's operating system and version.

OS Detected

  • Windows
  • OS X
  • iOS
  • Android
  • Linux
  • SymbOS
  • Nokia
  • BlackBerry
  • FreeBSD
  • OpenBSD
  • NetBSD
  • OpenSolaris
  • SunOS
  • OS2
  • BeOS

Example

if (Browser\OS::getOS() == Browser\OS::IOS) {
	echo 'You are using an iOS device.';
}

Language Detection

The Language class allow you to detect a user's language.

Example

if (Browser\Language::getLanguage() == 'de') {
	echo 'Get this website in german.';
}