Mobile Detect

Serban Ghita Free   Connect to feed
Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

Motto: "Every business should have a detection script to detect mobile readers."

About

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

Why

Your website's content strategy is important! You need a complete toolkit to deliver an experience that is optimized, fast and relevant to your users. Mobile Detect class is a server-side detection tool 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.

How

We're committed to make Mobile_Detect the best open-source mobile detection resource and this is why before each release we're running unit tests and research and update the detection rules on monthly basis.

Who

See the history of the project.

Example

var detect = new Mobile_Detect(new PhpArray() { }, "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405");

var isMobile = (bool)md.isMobile();
var isTablet = (bool)md.isTablet();

var knownBrowsers = (PhpArray)Mobile_Detect.getBrowsers(ContextExtensions.CurrentContext);

Announcements

  • JetBrains is sponsoring the project by providing licenses for PHPStorm and DataGrip.
  • Mobile_Detect 2.x.x is only integrating new regexes, User-Agents and tests. We are focusing on new tablets only. The rest of the PRs about TVs, bots or optimizations will be closed and analyzed after 3.0.0-beta is released.
  • Mobile_Detect 3.x.x is experimental and WIP.

Contribute

Submit a PR

Submit a pull request but before make sure you read how to contribute guide.

Donate

Paypal
Donate 👍

I'm currently paying for hosting and spend a lot of my family time to maintain the project and planning the future releases. I would highly appreciate any money donations that will keep the research going.

Special thanks to the community 👍 for donations, JetBrains team for the continuous support and Dragos Gavrila who contributed with the logo.

More information

mobiledetect.mobiledetectlib
2.8.37
7/21/2021
github.com/serbanghita/Mobile-Detect
licenses.nuget.org/MIT

Share