GithubHelp home page GithubHelp logo

chesterarc / php-browser-detector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sinergi/php-browser-detector

0.0 0.0 0.0 305 KB

Browser, Operating System (OS), Device, and Language Detection PHP Library

License: MIT License

PHP 100.00%

php-browser-detector's Introduction

Browser Detector

Build Status StyleCI Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads License SensioLabsInsight Join the chat at https://gitter.im/sinergi/php-browser-detector

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.

Requirements

This library uses PHP 5.3+.

Install

It is recommended that you install the PHP Browser library through composer. To do so, run the following command:

composer require sinergi/browser-detector

Browser Detection

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

Browsers Detected

  • Vivaldi
  • Opera
  • Opera Mini
  • WebTV
  • Internet Explorer
  • Pocket Internet Explorer
  • Microsoft Edge
  • Konqueror
  • iCab
  • OmniWeb
  • Firebird
  • Firefox
  • Iceweasel
  • Shiretoko
  • Mozilla
  • Amaya
  • Lynx
  • Safari
  • 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
  • Yandex Browser
  • Comodo Dragon
  • Samsung Browser
  • wkhtmltopdf

Usage

use Sinergi\BrowserDetector\Browser;

$browser = new Browser();

if ($browser->getName() === Browser::IE && $browser->getVersion() < 11) {
    echo 'Please upgrade your browser.';
}

Compatibility Mode

Detect if Internet Explorer is in Compatibility Mode and send the correct header to have the browser render the page in its standard mode. This must be called before any output is sent to the browser.

use Sinergi\BrowserDetector\Browser;

$browser = new Browser();

if ($browser->getName() === Browser::IE && $browser->isCompatibilityMode()) {
    $browser->endCompatibilityMode();
}

OS Detection

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

OS Detected

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

Usage

use Sinergi\BrowserDetector\Os;

$os = new Os();

if ($os->getName() === Os::IOS) {
    echo 'You are using an iOS device.';
}

Device Detection

The Device class allows you to detect a user's device.

Device Detected

  • iPad
  • iPhone
  • Windows Phone
  • Lumia

Usage

use Sinergi\BrowserDetector\Device;

$device = new Device();

if ($device->getName() === Device::IPAD) {
    echo 'You are using an iPad.';
}

Language Detection

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

Usage

use Sinergi\BrowserDetector\Language;

$language = new Language();

if ($language->getLanguage() === 'de') {
    echo 'Get this website in german.';
}

License

PHP Browser is licensed under The MIT License (MIT).

php-browser-detector's People

Contributors

adlenton avatar asdfklgash avatar blackbass1988 avatar cbulock avatar coreywynsma avatar gabrielbull avatar gitter-badger avatar igusev avatar janhohner avatar jonasschumacher avatar martin-song-ck avatar maxcoe avatar pavarnos avatar svenluijten avatar tigrazone avatar vinkla avatar yigit-serin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.