PHP Classes

PHP Mobile Detection Class: Detect the type of mobile device checking headers

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 295 This week: 1All time: 7,449 This week: 571Up
Version License PHP version Categories
mobile-detect 1.0.0MIT/X Consortium ...5.0HTTP, PHP 5, Wireless and Mobile
Description 

Author

This class can detect the type of mobile device checking headers.

It can check the HTTP request user agent and other request headers and detect the type of mobile device if the request comes from a user with a mobile browser.

The class looks up at an internal list of user agent strings known to be of mobile devices and returns information of whether the device is mobile or not, or is a phone or tablet, get the operating system.

Picture of Haseeb Ahmad Basil
  Performance   Level  
Name: Haseeb Ahmad Basil is available for providing paid consulting. Contact Haseeb Ahmad Basil .
Classes: 11 packages by
Country: Pakistan Pakistan
Age: 26
All time rank: 6147 in Pakistan Pakistan
Week rank: 33 Up1 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Recommendations

What is the best PHP detect browser and device class?
Detect browser and device details with platform

What is the best PHP detect mobile class?
Detect Mobile Browser

Example

<?php

include "Mobile_Detect.php";

$mobdect = new mobile_detect();
//Check to see of the device is a tabelt
$isTablet = $mobdect->isTablet();
//Check to see if the device is a Mobile
$isMobile = $mobdect->isMobile();
//Get all the predefined properties
$properties = $mobdect->getproperties();
var_dump($mobdect);
var_dump($isTablet);
var_dump($isMobile);
var_dump($properties);
foreach(
$properties as $key => $value)
{
   
//Check to see what are the versions of the properties
   
var_dump("$key =>",$mobdect->version($key));
}


  Files folder image Files  
File Role Description
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file license.txt Lic. License text
Plain text file Mobile_Detect.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:295
This week:1
All time:7,449
This week:571Up