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[29 issues](https://github.com/serbanghita/Mobile-Detect/issues)[4 PRs](https://github.com/serbanghita/Mobile-Detect/pulls)20MITPHPPHP &gt;=8.0CI passing

Since Nov 25Pushed 3mo ago574 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.8.x Synced 1mo ago

READMEChangelog (4)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)

[![Workflow status](https://camo.githubusercontent.com/f58c56996005b5353d786a56e091b73180524e5504b0da68fe2a294811fb3aca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f342e382e782d746573742e796d6c3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/f58c56996005b5353d786a56e091b73180524e5504b0da68fe2a294811fb3aca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f342e382e782d746573742e796d6c3f7374796c653d666c61742d737175617265)[![Latest tag](https://camo.githubusercontent.com/07d92b25d06c0a1ae8daa40def15aba94d1af2eff6b7e70bf8497f3f54e7344e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f73657262616e67686974612f4d6f62696c652d4465746563743f66696c7465723d342e2a267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/07d92b25d06c0a1ae8daa40def15aba94d1af2eff6b7e70bf8497f3f54e7344e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f73657262616e67686974612f4d6f62696c652d4465746563743f66696c7465723d342e2a267374796c653d666c61742d737175617265)[![Monthly Downloads](https://camo.githubusercontent.com/607076751f8320cd9a390cd88eda1588b2e55d890cb139fd05072dac798219f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265266c6162656c3d696e7374616c6c73)](https://camo.githubusercontent.com/607076751f8320cd9a390cd88eda1588b2e55d890cb139fd05072dac798219f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265266c6162656c3d696e7374616c6c73)[![Total Downloads](https://camo.githubusercontent.com/f5312bb0a2209df27d6924001d757a765cceaf699a3779a7045d673f795de4a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265266c6162656c3d696e7374616c6c73)](https://camo.githubusercontent.com/f5312bb0a2209df27d6924001d757a765cceaf699a3779a7045d673f795de4a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265266c6162656c3d696e7374616c6c73)[![MIT License](https://camo.githubusercontent.com/e12b57f4bbeba1a8dea5b7067daeff0b8ceeb5615676ac5a1cc182f8e885d983/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e12b57f4bbeba1a8dea5b7067daeff0b8ceeb5615676ac5a1cc182f8e885d983/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f62696c656465746563742f6d6f62696c656465746563746c69623f7374796c653d666c61742d737175617265)

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)

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

VersionTestsNamespaceCodePHP VersionStatus2.8.x[![5x](https://camo.githubusercontent.com/24da5d94edeaf31d22d45361bb61379e7fa2949fbbf7d8a9e232a36738816f2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f322e382e782d746573742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/actions/workflows/test.yml)`\Mobile_Detect`[2.8](https://github.com/serbanghita/Mobile-Detect/tree/2.8.x)&gt;=5.0,&lt;7.0Deprecated3.74.x[![7x](https://camo.githubusercontent.com/8a7dbe0aa57919e1cdf437ce29f1d5bf8c355dce9b223a8effaa58ee714644da/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f332e37342e782d746573742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/actions/workflows/test.yml)`Detection\MobileDetect`[3.74](https://github.com/serbanghita/Mobile-Detect/tree/3.74.x)&gt;=7.4,&lt;8.0LTS4.8.x[![7x](https://camo.githubusercontent.com/f58c56996005b5353d786a56e091b73180524e5504b0da68fe2a294811fb3aca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73657262616e67686974612f4d6f62696c652d4465746563742f342e382e782d746573742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/serbanghita/Mobile-Detect/actions/workflows/test.yml)`Detection\MobileDetect`[4.8](https://github.com/serbanghita/Mobile-Detect/tree/4.8.x)&gt;=8.0Current, **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

81

—

ExcellentBetter than 100% of packages

Maintenance79

Regular maintenance activity

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.3% 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 (721 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)")[![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)")[![h3xx](https://avatars.githubusercontent.com/u/615684?v=4)](https://github.com/h3xx "h3xx (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)
