PHP code example of grottopress / mobile-detector
1. Go to this page and download the library: Download grottopress/mobile-detector 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/ */
grottopress / mobile-detector example snippets
use GrottoPress\Mobile\Detector;
$detector = new Detector();
// Check if is iOS
if ($detector->isiOS()) {
//
}
// Check if is android
if ($detector->isAndroidOS()) {
//
}
// Check if is smart device
if ($detector->isSmart()) {
//
}
// Check if is phone
if ($detector->isPhone()) {
//
}
// Check if is tablet
if ($detector->isTablet()) {
//
}
// Check if is Samsung tablet
if ($detector->isSamsungTablet()) {
//
}
// Detect current device
$device = $detector->getDevice();
// Detect current browser
$browser = $detector->getBrowser();
// Detect current OS
$os = $detector->getOperatingSystem();
// More examples here: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples