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.11.0
178M downloads/mo
#306 most downloaded on Packagist
serbanghita/Mobile-Detect
What this package is like to depend on
Last release 3 months ago
24 May 2026
Release timing varies
gaps range from 9 days to 13 months
Rarely documented
notes for 13 of 93 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
93 releases · first in 2012
7 releases in the last 12 months
see the full history below
Release timeline
93 releases · Nov 2012 to May 2026Releases
latest 60 of 93-
4.11.024 May 2026Release notes
Open source →What's Changed
- perf(bench): overhaul phpbench suite + advisory CI + release hygiene by @serbanghita in #1015
Full Changelog: 4.10.0...4.11.0
Release notes
Open source →Security
- [x] GHSA-mgj4-qjmw-v56v — the bundled
Detection\Cache\Cacheis now bounded (default 1000 entries, FIFO eviction). Prevents unbounded in-memory growth when oneMobileDetectinstance is reused across many distinct User-Agents in a long-running PHP runtime (RoadRunner, Laravel Octane, FrankenPHP worker mode, Swoole, ReactPHP, queue workers). Not applicable to classic PHP-FPM / mod_php deployments — the cache dies with the request. Custom PSR-16 adapters (Redis, APCu, Memcached, Filesystem) are out of scope; their eviction policy is the operator's responsibility.
Added
- [x]
Detection\Cache\Cache::__construct(int $maxEntries = Cache::DEFAULT_MAX_ENTRIES)— tune the in-memory cap vianew MobileDetect(new Cache($n)). - [x]
Cache::DEFAULT_MAX_ENTRIESconstant (1000) andCache::getMaxEntries()accessor.
Changed
- [x]
README-EXAMPLES.md"Long-Running Processes" — worker example now usesclear()(wasevictExpired(), which is a no-op against fresh entries under the default 86 400 s TTL); added explicit note framing in-memory cache bounding as a systems-level concern with the bundled cap, and pointing operators at their own adapter's eviction for custom PSR-16 backends. - [x]
Cache::evictExpired()docblock — clarified that it bounds by expiration, not by cardinality. Method behavior is unchanged.
-
4.10.023 Apr 2026Release notes
Open source →What's Changed
- fix(cache): restore PSR-16 v1/v2 LSP compatibility (#989) by @serbanghita in #1014
Full Changelog: 4.9.0...4.10.0
Release notes
Open source →Changed
- [x]
Detection\Cache\Cachemethod signatures widened to be Liskov-compatible withpsr/simple-cachev1, v2, and v3 simultaneously. Resolves #989 — the class no longer fatals at load time on hosts where another package has already registered an olderCacheInterface(common in WordPress stacks). - [x]
composer.json:psr/simple-cacheconstraint widened to^1.0 || ^2.0 || ^3.0. - [x] Minimum PHP version raised to 8.2 in
composer.json(was>=8.0). PHP 8.0 and 8.1 are both end-of-life and had already been dropped from CI in 4.9.0 becausephpbench/phpbench: 1.6.1requires PHP ^8.2.
Added
- [x]
psr16-compatCI matrix that verifies Cache remains LSP-compatible with every supported major ofpsr/simple-cache(1.x, 2.x, 3.x).
BC note
- Subclasses of
Detection\Cache\Cachethat overrodeget/set/has/delete/getMultiple/setMultiple/deleteMultiple(or protectedcheckKey) with narrowed parameter types (e.g.function get(string $key, …)) will fatal at class load on this version. Drop the scalar type from the override, or widen tomixed, to restore LSP compatibility.
-
4.9.023 Apr 2026Release notes
Open source →Minor release.
Added
- Lenovo: broad
Lenovo TBprefix match for modern tablets (#1013). - Samsung: 2025 tablet models (Tab S11, S10 Lite, A11).
MobileDetect::VERSION_TYPE_STRINGandVERSION_TYPE_FLOATconstants promoted topublic(#991).
Changed
- Consistent late static binding for subclass extensibility (#1012).
- Dropped PHP 8.0 and 8.1 from the CI matrix.
Fixed
- PHP 8.4 compatibility: explicit type hints where the engine now requires them.
Cache::getTimestamp()method name typo (wasgetTimeStamp) (#1007).- Version regex now accepts multi-char pre-release suffixes.
- Pinned composer dependencies to exact versions.
- GitHub Actions workflow actions updated to their latest versions.
Full changelog: 4.8.10...4.9.0
Release notes
Open source →Added
- [x] Lenovo: broad
Lenovo TBprefix match for modern tablets (#1013). - [x] Samsung: 2025 tablet models (Tab S11, S10 Lite, A11).
- [x]
MobileDetect::VERSION_TYPE_STRINGandVERSION_TYPE_FLOATconstants promoted topublic(#991).
Changed
- [x] Consistent late static binding for subclass extensibility (#1012).
- [x] Dropped PHP 8.0 and 8.1 from the CI matrix.
Fixed
- [x] PHP 8.4 compatibility: explicit type hints where the engine now requires them.
- [x]
Cache::getTimestamp()method name typo (wasgetTimeStamp) (#1007). - [x] Version regex now accepts multi-char pre-release suffixes.
- [x] Pinned composer dependencies to exact versions.
- [x] GitHub Actions workflow actions updated to their latest versions.
- Lenovo: broad
-
4.8.1009 Jan 2026Release notes
Open source →Fixed
- [x]
Cache::has()now properly checks TTL expiration before returningtrue(PSR-16 compliance fix). Previously,has()returnedtruefor expired items.
Added
- [x]
Cache::evictExpired()method to manually clean up expired cache entries. Useful for long-running processes (CLI scripts, workers, daemons) to prevent memory growth. - [x] Expanded test coverage for
Cacheclass: added 17 new tests covering all if/else branches including custom defaults, DateInterval TTL, key validation edge cases, and expiration scenarios. - [x]
README-EXAMPLES.mdwith comprehensive usage examples including long-running processes, framework integration, and debugging.
Changed
- [x]
Cache::has()now deletes expired items on check (lazy cleanup, consistent withget()behavior).
- [x]
-
3.74.415 Apr 2026 -
3.74.327 Oct 2023Nothing published for this version
-
3.74.217 Oct 2023Nothing published for this version
-
3.74.004 Dec 2022Nothing published for this version
-
2.8.4714 Apr 2026 -
2.8.4614 Apr 2026 -
2.8.4507 Nov 2023Nothing published for this version
-
2.8.4407 Nov 2023Nothing published for this version
-
2.8.4301 Nov 2023Nothing published for this version
-
2.8.4227 Oct 2023Nothing published for this version
-
2.8.4108 Nov 2022Nothing published for this version
-
2.8.4008 Nov 2022Nothing published for this version
-
2.8.3917 Feb 2022Nothing published for this version
-
2.8.3814 Feb 2022Nothing published for this version
-
2.8.3719 Feb 2021Nothing published for this version
-
2.8.3613 Feb 2021Nothing published for this version
-
2.8.3525 Jan 2021Nothing published for this version
-
2.8.3418 Sep 2019Nothing published for this version
-
2.8.3301 Sep 2018Nothing published for this version
-
2.8.3203 Jun 2018Nothing published for this version
-
2.8.3126 Feb 2018Nothing published for this version
-
2.8.3018 Dec 2017Nothing published for this version
-
2.8.2910 Dec 2017Nothing published for this version
-
2.8.2809 Dec 2017Nothing published for this version
-
2.8.2703 Dec 2017Nothing published for this version
-
2.8.2629 Aug 2017Nothing published for this version
-
2.8.2529 Mar 2017Nothing published for this version
-
2.8.2411 Nov 2016Nothing published for this version
-
2.8.2310 Nov 2016Nothing published for this version
-
2.8.2224 Apr 2016Nothing published for this version
-
2.8.2118 Apr 2016Nothing published for this version
-
2.8.2024 Mar 2016Nothing published for this version
-
2.8.1924 Dec 2015Nothing published for this version
-
2.8.1824 Dec 2015Nothing published for this version
-
2.8.1717 Sep 2015Nothing published for this version
-
2.8.1631 Aug 2015Nothing published for this version
-
2.8.1518 Jun 2015Nothing published for this version
-
2.8.1416 Jun 2015Nothing published for this version
-
2.8.1325 Apr 2015Nothing published for this version
-
2.8.1211 Mar 2015Nothing published for this version
-
2.8.1123 Nov 2014Nothing published for this version
-
2.8.1022 Nov 2014Nothing published for this version
-
2.8.822 Nov 2014Nothing published for this version
-
2.8.720 Nov 2014Nothing published for this version
-
2.8.620 Nov 2014Nothing published for this version
-
2.8.520 Oct 2014Nothing published for this version
-
2.8.425 Aug 2014Nothing published for this version
-
2.8.310 Jul 2014Nothing published for this version
-
2.8.216 Jun 2014Nothing published for this version
-
2.8.104 Jun 2014Nothing published for this version
-
2.8.021 Apr 2014Nothing published for this version
-
2.7.907 Mar 2014Nothing published for this version
-
2.7.805 Feb 2014Nothing published for this version
-
2.7.717 Jan 2014Nothing published for this version
-
2.7.605 Dec 2013Nothing published for this version
-
2.7.527 Nov 2013Nothing published for this version