PHP code example of gabrielbull / browser

1. Go to this page and download the library: Download gabrielbull/browser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gabrielbull / browser example snippets


use Sinergi\BrowserDetector\Browser;

$browser = new Browser();

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

use Sinergi\BrowserDetector\Browser;

$browser = new Browser();

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

use Sinergi\BrowserDetector\Os;

$os = new Os();

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

use Sinergi\BrowserDetector\Device;

$device = new Device();

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

use Sinergi\BrowserDetector\Language;

$language = new Language();

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