PHPackages                             mobiledetect/mobiledetectlib - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mobiledetect/mobiledetectlib

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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.

4.8.10(4mo ago)10.7k159.4M—2.3%2.6k[18 issues](https://github.com/serbanghita/Mobile-Detect/issues)20MITPHPPHP &gt;=8.0CI passing

Since Nov 25Pushed 3w ago571 watchersCompare

[ Source](https://github.com/serbanghita/Mobile-Detect)[ Packagist](https://packagist.org/packages/mobiledetect/mobiledetectlib)[ Docs](https://github.com/serbanghita/Mobile-Detect)[ GitHub Sponsors](https://github.com/serbanghita)[ RSS](/packages/mobiledetect-mobiledetectlib/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (95)Used By (20)Security (1)

[![Mobile Detect](https://camo.githubusercontent.com/87ca8ba4250fa3c1861ca506e0b3eb5c31a5c7dea1cd94e42bf0d2dc9c2cff21/687474703a2f2f64656d6f2e6d6f62696c656465746563742e6e65742f6c6f676f2d6769746875622e706e67)](https://camo.githubusercontent.com/87ca8ba4250fa3c1861ca506e0b3eb5c31a5c7dea1cd94e42bf0d2dc9c2cff21/687474703a2f2f64656d6f2e6d6f62696c656465746563742e6e65742f6c6f676f2d6769746875622e706e67)

MobileDetect, PHP mobile detection class
========================================

[](#mobiledetect-php-mobile-detection-class)

[![Build status](https://camo.githubusercontent.com/6e5f3b154e781680d2670c24c8c39ee8accb408d34ba487240bff6c11fdb0780/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f342e782d746573742e796d6c3f6272616e63683d342e78266c6162656c3d6275696c64267374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/actions/workflows/4.x-test.yml)[![Latest stable version](https://camo.githubusercontent.com/7db2e7ecc3d69103bbef61d0119f04be48b20578532700a5359ee01303bad772/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mobiledetect/mobiledetectlib)[![Latest tag](https://camo.githubusercontent.com/07d92b25d06c0a1ae8daa40def15aba94d1af2eff6b7e70bf8497f3f54e7344e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f73657262616e67686974612f4d6f62696c652d4465746563743f66696c7465723d342e2a267374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/tags)[![Monthly Downloads](https://camo.githubusercontent.com/607076751f8320cd9a390cd88eda1588b2e55d890cb139fd05072dac798219f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265266c6162656c3d696e7374616c6c73)](https://packagist.org/packages/mobiledetect/mobiledetectlib/stats)[![Total Downloads](https://camo.githubusercontent.com/f5312bb0a2209df27d6924001d757a765cceaf699a3779a7045d673f795de4a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265266c6162656c3d696e7374616c6c73)](https://packagist.org/packages/mobiledetect/mobiledetectlib/stats)[![MIT License](https://camo.githubusercontent.com/e12b57f4bbeba1a8dea5b7067daeff0b8ceeb5615676ac5a1cc182f8e885d983/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/blob/4.x/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
------------------

[](#before-you-install)

MobileDetect is maintained on one rolling branch per major line. Tags follow the pattern `..` and always live on the matching branch.

VersionTestsNamespaceBranchPHP VersionPurpose2.\*[![2.x tests](https://camo.githubusercontent.com/77e40878ddc203a1ccac305f615447917e29fb47b1e5ddad12c915404e6cac4a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f322e782d746573742e796d6c3f6272616e63683d322e78267374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/actions/workflows/2.x-test.yml)`\Mobile_Detect`[`2.x`](https://github.com/serbanghita/Mobile-Detect/tree/2.x)&gt;=5.6,&lt;7.0Deprecated3.\*[![3.x tests](https://camo.githubusercontent.com/d0866989932e97400b0be9003154661a15c1f7d4a55d7d4325a685733888cb27/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f332e782d746573742e796d6c3f6272616e63683d332e78267374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/actions/workflows/3.x-test.yml)`Detection\MobileDetect`[`3.x`](https://github.com/serbanghita/Mobile-Detect/tree/3.x)&gt;=7.4,&lt;8.0LTS4.\*[![4.x tests](https://camo.githubusercontent.com/c88aff29d3e516b21d7f031d8c4f036c256094274e2284e71fdd6b7b1a6bf4db/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f342e782d746573742e796d6c3f6272616e63683d342e78267374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/actions/workflows/4.x-test.yml)`Detection\MobileDetect`[`4.x`](https://github.com/serbanghita/Mobile-Detect/tree/4.x)&gt;=8.2 (since 4.10.0, previously &gt;=8.0)Current, **Recommended**🤝 Supporting
------------

[](#-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 👍](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mobiledetectlib%40gmail%2ecom&lc=US&item_name=Mobile%20Detect&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted).

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](https://www.gitbook.com/) team for the open-source license for their technical documentation tool.

📃 Documentation
---------------

[](#-documentation)

The entire documentation is available on Gitbook:

👾 Demo
------

[](#-demo)

Point your device to:

🐛 Testing
---------

[](#-testing)

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

🤝 Contributing
--------------

[](#-contributing)

Please see the [Contribute guide](https://mobile-detect.gitbook.io/home/contribute) for details.

🔒 Security
----------

[](#--security)

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

🎉 Credits
---------

[](#-credits)

- [Serban Ghita](https://github.com/serbanghita)
- [All Contributors](https://mobile-detect.gitbook.io/home/credits)

###  Health Score

83

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity89

Widely adopted with strong download metrics

Community64

Healthy contributor diversity

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 83.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Recently: every ~106 days

Total

90

Last Release

98d ago

Major Versions

2.8.41 → 3.74.02022-12-04

3.74.0 → 4.8.012023-10-06

2.8.42 → 4.8.042023-10-28

2.8.45 → 4.8.052024-01-10

2.8.x-dev → 4.8.x-dev2026-02-09

PHP version history (4 changes)2.5.0PHP &gt;=5.0.0

3.74.0PHP &gt;=7.4

4.8.01PHP &gt;=8.0

2.8.42PHP 5.6.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/ddd460f765d06d9f5db2f7076125b13a15da46097a725f477b602952d659f9ca?d=identicon)[serbanghita](/maintainers/serbanghita)

---

Top Contributors

[![serbanghita](https://avatars.githubusercontent.com/u/1106849?v=4)](https://github.com/serbanghita "serbanghita (742 commits)")[![Garthi](https://avatars.githubusercontent.com/u/1264105?v=4)](https://github.com/Garthi "Garthi (43 commits)")[![nicktacular](https://avatars.githubusercontent.com/u/810546?v=4)](https://github.com/nicktacular "nicktacular (38 commits)")[![ilaoniu](https://avatars.githubusercontent.com/u/9882927?v=4)](https://github.com/ilaoniu "ilaoniu (5 commits)")[![darapa1](https://avatars.githubusercontent.com/u/73847654?v=4)](https://github.com/darapa1 "darapa1 (4 commits)")[![jenssegers](https://avatars.githubusercontent.com/u/194377?v=4)](https://github.com/jenssegers "jenssegers (4 commits)")[![eidng8](https://avatars.githubusercontent.com/u/787265?v=4)](https://github.com/eidng8 "eidng8 (4 commits)")[![bhamodi](https://avatars.githubusercontent.com/u/7663987?v=4)](https://github.com/bhamodi "bhamodi (3 commits)")[![lxlang](https://avatars.githubusercontent.com/u/7984421?v=4)](https://github.com/lxlang "lxlang (3 commits)")[![mbezhanov](https://avatars.githubusercontent.com/u/785542?v=4)](https://github.com/mbezhanov "mbezhanov (3 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (3 commits)")[![tluan95](https://avatars.githubusercontent.com/u/69115657?v=4)](https://github.com/tluan95 "tluan95 (3 commits)")[![hpbuniat](https://avatars.githubusercontent.com/u/214626?v=4)](https://github.com/hpbuniat "hpbuniat (2 commits)")[![drbyte](https://avatars.githubusercontent.com/u/404472?v=4)](https://github.com/drbyte "drbyte (2 commits)")[![jbinfo](https://avatars.githubusercontent.com/u/761378?v=4)](https://github.com/jbinfo "jbinfo (2 commits)")[![DeviaVir](https://avatars.githubusercontent.com/u/777823?v=4)](https://github.com/DeviaVir "DeviaVir (2 commits)")[![julienbornstein](https://avatars.githubusercontent.com/u/548449?v=4)](https://github.com/julienbornstein "julienbornstein (2 commits)")[![blankse](https://avatars.githubusercontent.com/u/998558?v=4)](https://github.com/blankse "blankse (2 commits)")[![sergeifilippov](https://avatars.githubusercontent.com/u/123676?v=4)](https://github.com/sergeifilippov "sergeifilippov (2 commits)")[![EugenyP](https://avatars.githubusercontent.com/u/5616093?v=4)](https://github.com/EugenyP "EugenyP (2 commits)")

---

Tags

device-detectionmobile-detectmobile-redirectsphpuser-agentsmobilemobile detectmobile detectorphp mobile detectdetect mobile devices

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mobiledetect-mobiledetectlib/health.svg)

```
[![Health](https://phpackages.com/badges/mobiledetect-mobiledetectlib/health.svg)](https://phpackages.com/packages/mobiledetect-mobiledetectlib)
```

###  Alternatives

[jenssegers/agent

Desktop/mobile user agent parser with support for Laravel, based on Mobiledetect

4.8k67.8M440](/packages/jenssegers-agent)[suncat/mobile-detect-bundle

Symfony2/3/4 bundle for detect mobile devices, managing mobile view types, redirect to mobile version.

4035.3M7](/packages/suncat-mobile-detect-bundle)[hisorange/browser-detect

Browser &amp; Mobile detection package for Laravel.

1.1k10.1M50](/packages/hisorange-browser-detect)[eo/passbook

iOS Passbook for PHP

2651.6M2](/packages/eo-passbook)[instasent/sms-counter-php

SMS Counter PHP Class Library which detects encoding of an SMS message text, counts the characters as per the encoding and gives page limit information.

491.3M4](/packages/instasent-sms-counter-php)[jbinfo/mobile-detect-service-provider

A mobile detect ServiceProvider for Silex, based on Mobile-Detect library.

25332.2k](/packages/jbinfo-mobile-detect-service-provider)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
