PHP code example of bugbuster / contao-mobiledetection-bundle
1. Go to this page and download the library: Download bugbuster/contao-mobiledetection-bundle 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/ */
bugbuster / contao-mobiledetection-bundle example snippets
use Detection\MobileDetect;
$detect = new MobileDetect();
// Check for any mobile device.
if ($detect->isMobile())
// Check for any tablet.
if($detect->isTablet())
// Check for any mobile device, excluding tablets.
if ($detect->isMobile() && !$detect->isTablet())
use BugBuster\MobileDetection\Mobile_Detection;
...
$this->Mobile_Detection = new Mobile_Detection();
// Check device type
echo $this->Mobile_Detection->getDeviceType(); // phone|tablet|computer
// Check for any mobile device.
if ($this->Mobile_Detection->isMobile())
// Check for any tablet.
if ($this->Mobile_Detection->isTablet())
// Check mobile grade
echo $this->Mobile_Detection->getMobileGrade(); // A|B|C
// Check mobile rules
$arrRules = $this->Mobile_Detection->getMobileRules();
// result e.g. array('SamsungTablet','AndroidOS','Safari')