serbanghita/Mobile-Detect

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.

PHPMIT10.7k2.6k12233 open issues
Created Aug 31, 2012Last commit Feb 9, 2026Last human commit Feb 9, 2026
device-detectionmobile-detectmobile-redirectsphpuser-agents
Embed Badge
Play on Codakey
Markdown
[![Play on Codakey](https://codakey.io/badge.svg)](https://codakey.io/projects/serbanghita-mobile-detect)
HTML
<a href="https://codakey.io/projects/serbanghita-mobile-detect"><img src="https://codakey.io/badge.svg" alt="Play on Codakey" height="28" /></a>

Daily Activity

Monthly Activity

Star History

README

Mobile Detect

MobileDetect, PHP mobile detection class

Workflow status Latest tag Monthly Downloads Total Downloads MIT License

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.

Before you install

There are three versions of MobileDetect. 4.8.x is the main version that is ALWAYS going to be updated first.

VersionTestsNamespaceCodePHP VersionStatus
2.8.x5x\Mobile_Detect2.8>=5.0,<7.0Deprecated
3.74.x7xDetection\MobileDetect3.74>=7.4,<8.0LTS
4.8.x7xDetection\MobileDetect4.8>=8.0Current, Recommended

🤝 Supporting

If you are using Mobile Detect open-source package in your production apps, in presentation demos, hobby projects, school projects or so, you can sponsor my work by donating a small amount :+1:.

I'm currently paying for domains, 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.

Special thanks to:

  • the community :+1: for donations, submitting patches and issues
  • Gitbook team for the open-source license for their technical documentation tool.

📃 Documentation

The entire documentation is available on Gitbook: https://docs.mobiledetect.net

👾 Demo

Point your device to: https://demo.mobiledetect.net

🐛 Testing

vendor/bin/phpunit -v -c tests/phpunit.xml --coverage-html .coverage

🤝 Contributing

Please see the Contribute guide for details.

🔒 Security

If you discover any security related issues, please email serbanghita@gmail.com instead of using the issue tracker.

🎉 Credits

Related Projects