mobiledetect/mobiledetectlib
Lightweight PHP library to detect mobile devices and tablets using the User-Agent and HTTP headers. Simple API to check for phones, tablets, OS and browsers. Actively maintained (4.8.x) with older LTS/deprecated branches available.
Cache::has() now properly checks TTL expiration before returning true (PSR-16 compliance fix). Previously, has() returned true for expired items.Cache::has() now deletes expired items on check (lazy cleanup, consistent with get() behavior).sha1 is now the default fn for encoding cache keys. Using base64 was causing problems in Laravel.$config to MobileDetect constructor.autoInitOfHttpHeaders configuration which is by default true. This enabled the old behavior from 3.x and 2.x that allows automatic detection of HTTP headers and User Agent from $_SERVER.setHttpHeaders work. It no longer falls back on $_SERVER. The method still calls setUserAgent in case HTTP_USER_AGENT and friends are present.maximumUserAgentLength to the $config, by default the limit is 500.CacheFactory class where you can inject your own PSR-6 Cache interfaces.setUserAgent("...") or setUserAgentHeaders([...]) otherwise an exception is being thrown.scripts/ folder no longer included in the git tag release archive.Launched 4.8.xx which contains PHP 8.x support, refactorings and external Cache support.
Cache::evictExpired() method to manually clean up expired cache entries. Useful for long-running processes (CLI scripts, workers, daemons) to prevent memory growth.Cache class: added 17 new tests covering all if/else branches including custom defaults, DateInterval TTL, key validation edge cases, and expiration scenarios.README-EXAMPLES.md with comprehensive usage examples including long-running processes, framework integration, and debugging.In December 2022 we released the version for PHP7.
Mobile Detect was split into two dev branches: 2.8.x which will support PHP5, but is deprecated and
3.74.x which supports PHP >= 7.3
In August 2013 the library has 1800+ stargazers and support for: composer, PHPUnit tests, PSR standards and a new webpage http://mobiledetect.net
Throughout 2012 the script has been updated constantly, and we have received tons of feedback and requests. In July 2012 we moved the repository from Google Code to GitHub in order to quickly accommodate the frequent updates and to involve more people.
In December 2011 it received a major update from the first version, an important number of issues were fixed, then 2.0 was launched. The new version marks a new mindset and also featuring tablet detection.
The first version of the script was developed in 2009, and it was hosted at https://code.google.com/p/php-mobile-detect/, it was a small project with around 30 stars. (Original blog post by Victor: http://victorstanciu.ro/detectarea-platformelor-mobile-in-php/)
How can I help you explore Laravel packages today?