mobiledetect / mobiledetectlib
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.
Fund package maintenance!
Requires
- php: >=8.2
- psr/simple-cache: ^1.0 || ^2.0 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: 3.95.1
- phpbench/phpbench: 1.6.1
- phpstan/phpstan: 2.1.47
- phpunit/phpunit: 9.6.34
- squizlabs/php_codesniffer: 3.13.5
- 4.x-dev
- 4.10.0
- 4.9.0
- 4.8.x-dev
- 4.8.10
- 4.8.09
- 4.8.08
- 4.8.07
- 4.8.06
- 4.8.05
- 4.8.04
- 4.8.03
- 4.8.02
- 4.8.01
- 3.x-dev
- 3.74.4
- 3.74.3
- 3.74.2
- 3.74.0
- 2.x-dev
- 2.8.47
- 2.8.46
- 2.8.45
- 2.8.44
- 2.8.43
- 2.8.42
- 2.8.41
- 2.8.40
- 2.8.39
- 2.8.38
- 2.8.37
- 2.8.36
- 2.8.35
- 2.8.34
- 2.8.33
- 2.8.32
- 2.8.31
- 2.8.30
- 2.8.29
- 2.8.28
- 2.8.27
- 2.8.26
- 2.8.25
- 2.8.24
- 2.8.23
- 2.8.22
- 2.8.21
- 2.8.20
- 2.8.19
- 2.8.18
- 2.8.17
- 2.8.16
- 2.8.15
- 2.8.14
- 2.8.13
- 2.8.12
- 2.8.11
- 2.8.10
- 2.8.8
- 2.8.7
- 2.8.6
- 2.8.5
- 2.8.4
- 2.8.3
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.9
- 2.5.8
- 2.5.7
- 2.5.6
- 2.5.5
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.0
- dev-perf/bench-review
- dev-copilot/review-opened-issues
- dev-sync-regexes-374x
- dev-ilaoniu-fix-cache
- dev-devel-3-workinprogress
- dev-devel-3
- dev-jsonify
This package is auto-updated.
Last update: 2026-04-26 14:08:56 UTC
README
MobileDetect, PHP mobile detection class
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.* | \Mobile_Detect |
2.x |
>=5.6,<7.0 | Deprecated | |
| 3.* | Detection\MobileDetect |
3.x |
>=7.4,<8.0 | LTS | |
| 4.* | 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 👍.
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 👍 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.