serbanghita/mobile-detect — explained in plain English
Analysis updated 2026-06-24
Redirect mobile visitors to a mobile-optimized layout or skip loading heavy assets on small screens.
Detect tablets separately from phones in a PHP app to apply different UI treatments for each device type.
Drop the library into a legacy PHP 7.4 environment using the long-term support v3 branch.
| serbanghita/mobile-detect | mockery/mockery | tennc/webshell | |
|---|---|---|---|
| Stars | 10,682 | 10,724 | 10,727 |
| Language | PHP | PHP | PHP |
| Setup difficulty | easy | easy | easy |
| Complexity | 2/5 | 2/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Version 4 requires PHP 8.2 or higher, use v3 for PHP 7.4 environments.
Mobile-Detect is a PHP library that tells your web application whether the current visitor is using a mobile phone or tablet. It works by reading the User-Agent string, which is a short piece of text that every browser sends with each request to identify itself, and combining that with certain HTTP headers to figure out what kind of device is making the request. The use case is straightforward: if you want your PHP application to behave differently for mobile visitors, such as redirecting them to a mobile layout, skipping heavy assets, or adjusting features, you include this library and call its detection methods. The library is small and focused entirely on device detection rather than being a general-purpose browser utility. The library has three active version lines. Version 2 is deprecated and only supports older PHP releases. Version 3 is in long-term support mode for PHP 7.4 environments. Version 4 is the current recommended version and requires PHP 8.2 or higher. Each version lives on its own branch on GitHub. Users on modern PHP should use version 4. Documentation is hosted on Gitbook, and there is a live demo site where you can point a mobile browser to see what the library detects about your device. The project is open source under the MIT license and maintained by the original author, who accepts donations to cover hosting and development time.
Mobile-Detect is a PHP library that tells your app whether the current visitor is on a mobile phone or tablet by reading browser headers, so you can serve different layouts or features per device.
Mainly PHP. The stack also includes PHP.
MIT license, use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.