MobileDetect PHP
Github4.8.x3.74.x2.8.xDemo
  • Introduction
  • Install
  • How to use (composer)
  • How to use (standalone)
  • The constructor
  • Example
  • Other versions
  • Demo
  • Performance
  • Contribute
  • Developing code
  • Project structure
  • Extending / Porting
  • Add new module, plugin or port
  • Plugins, Modules and Ports
  • Credits
Powered by GitBook
On this page
  • What is it?
  • How does it work?
  • Before you install

Was this helpful?

Edit on GitHub

Introduction

Welcome to the guide on how to use Mobile Detect PHP library in your project.

NextInstall

Last updated 4 months ago

Was this helpful?

Workflow status
Latest tag
Monthly Downloads
Total Downloads
MIT License

What is it?

Mobile Detect is a lightweight PHP package for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

  • Can detect the difference between a mobile phone and a tablet by using regexes.


How does it work?

MobileDetect class uses a list of regexes ordered by importance.

The regexes can be grouped as a string containing matching words separated by pipe: "iPad|iPad.*Mobile" or grouped into arrays of smaller strings sequences in order to avoid memory issues.

There are four types of regexes: browsers, operatingSystems, mobile and tablet.

All the regexes inside MobileDetect.php file refer to "mobile" devices, not "desktop" or other type of devices.

The library's main purpose is to detect "mobile" devices and attempt to figure out if the "mobile" device is a "phone" or a "tablet".

Before you install

There are three versions of MobileDetect.

4.8.x is the main version that is ALWAYS going to be updated first.

MobileDetect class is a PHP class that can help you with your RWD strategy, it is not a replacement for CSS3 media queries or other forms of client-side feature detection.

The accuracy and relevance of the detection is kept by running to check for detection conflicts.

server-side detection
tests