Mobile-Detect README

The project's README from github.com/serbanghita/Mobile-Detect. As one markdown file: README.md.

Mobile Detect

MobileDetect, PHP mobile detection class

Build status Latest stable version 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

MobileDetect is maintained on one rolling branch per major line. Tags follow the pattern <major>.<minor>.<patch> and always live on the matching branch.

Version Tests Namespace Branch PHP Version Purpose
2.* 2.x tests \Mobile_Detect 2.x >=5.6,<7.0 Deprecated
3.* 3.x tests Detection\MobileDetect 3.x >=7.4,<8.0 LTS
4.* 4.x tests Detection\MobileDetect 4.x >=8.2 (since 4.10.0, previously >=8.0) Current, 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:

📃 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 [email protected] instead of using the issue tracker.

🎉 Credits

Mobile-Detect (serbanghita/Mobile-Detect)

Searching Database…

What is this?Mobile Detect is a lightweight PHP class that tells your server whether a visitor is on a mobile device, including tablets, by reading the request's User-Agent string and specific HTTP headers.
Is it a library I add to my server-side code, or something visitors install?A plain PHP library: you include the class in your own backend code, and visitors just load your site normally — nothing is installed on their devices.
How do I add it to my project?The README keeps the full install guide on Gitbook, its documentation home; releases live on one rolling branch per major version line, so you pick the line matching your PHP.
Do I need anything besides PHP on my server?No — it works from the incoming HTTP request alone; the README lists no database, PHP extensions or other services as requirements.
Is there a catch with PHP versions?Yes — the current, recommended 4.x line targets modern PHP 8, so older apps stay on the legacy 2.x branch (which supports PHP back to 5.6).
Can I try it before installing?Yes — the README links an online demo that you open from the device you want to check, so you can see how your own phone or tablet gets detected.
Does it distinguish tablets from phones?Tablets are explicitly in scope — the class targets mobile devices including tablets, using the same User-Agent and HTTP header checks.
Is it free for commercial projects?Yes — Mobile Detect is MIT licensed, so it can be used in commercial apps for free; the author only asks happy users to consider sponsoring the maintenance.
Is the project still alive?Yes — it has been around since 2012, is maintained on rolling per-major branches, and the repository runs CI workflows for tests and performance benchmarks.
Size
4.3 MB
Stars
10.7K
Age
14y
Commits · 90 Days