PHP Classes

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

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 296 All time: 7,451 This week: 63Up
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: United States United States
Age: 26
All time rank: 60981 in United States United States
Week rank: 10 Up1 in United States United States 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 (3)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:296
This week:0
All time:7,451
This week:63Up