Download the PHP package pataar/browser-detect without Composer
On this page you can find all versions of the php package pataar/browser-detect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pataar/browser-detect
More information about pataar/browser-detect
Files in pataar/browser-detect
Package browser-detect
Short Description Browser & Mobile detection package for Laravel.
License MIT
Homepage https://github.com/pataar/browser-detect
Informations about the package browser-detect
Browser Detect
A Laravel package to identify the visitor's browser, operating system, and device type. Results are powered by two well-tested detection libraries — no magic involved.
Fork notice: This is a maintained fork of hisorange/browser-detect by Varga Zsolt, which appears to be abandoned. Full credit to the original author for the design and initial implementation.
Changes from the original
- PHP 8.3+ and Laravel 12–13 support (dropped older versions)
- Removed
ua-parser/ua-parserandmobiledetect/mobiledetect— detection is now powered by fewer, better-maintained libraries
Requirements
- PHP 8.3+
- Laravel 12 or 13 (or standalone without Laravel)
Installation
That's it — Laravel auto-discovers the service provider and facade.
Usage
Facade
Blade directives
Standalone (without Laravel)
Parsing a specific user agent
Results are cached in memory for the current request and optionally persisted via Laravel's cache (7-day TTL by default).
API Reference
Device detection
| Method | Returns | Description |
|---|---|---|
Browser::isMobile() |
bool |
Is this a mobile device? |
Browser::isTablet() |
bool |
Is this a tablet device? |
Browser::isDesktop() |
bool |
Is this a desktop computer? |
Browser::isBot() |
bool |
Is this a crawler / bot? |
Browser::deviceType() |
string |
One of: Mobile, Tablet, Desktop, Bot |
Browser::deviceFamily() |
string |
Device vendor (Samsung, Apple, Huawei, ...) |
Browser::deviceModel() |
string |
Device model (iPad, iPhone, Nexus, ...) |
Browser detection
| Method | Returns | Description |
|---|---|---|
Browser::browserName() |
string |
Human-friendly name (e.g. Firefox 3.6) |
Browser::browserFamily() |
string |
Vendor (Chrome, Firefox, Opera, ...) |
Browser::browserVersion() |
string |
Version string with trailing .0 trimmed |
Browser::browserVersionMajor() |
int |
Semantic major version |
Browser::browserVersionMinor() |
int |
Semantic minor version |
Browser::browserVersionPatch() |
int |
Semantic patch version |
Browser::browserEngine() |
string |
Rendering engine (Blink, WebKit, Gecko, ...) |
Browser::isChrome() |
bool |
Chrome or Chromium? |
Browser::isFirefox() |
bool |
Firefox? |
Browser::isOpera() |
bool |
Opera? |
Browser::isSafari() |
bool |
Safari? |
Browser::isEdge() |
bool |
Microsoft Edge? |
Browser::isIE() |
bool |
Internet Explorer (or Trident)? |
Browser::isIEVersion(int, op) |
bool |
Compare against a specific IE version |
Browser::isInApp() |
bool |
In-app browser (WebView, Twitter, WeChat)? |
Operating system detection
| Method | Returns | Description |
|---|---|---|
Browser::platformName() |
string |
Human-friendly name (e.g. Windows 10) |
Browser::platformFamily() |
string |
Vendor (Linux, Windows, Mac, ...) |
Browser::platformVersion() |
string |
Version string with trailing .0 trimmed |
Browser::platformVersionMajor() |
int |
Semantic major version |
Browser::platformVersionMinor() |
int |
Semantic minor version |
Browser::platformVersionPatch() |
int |
Semantic patch version |
Browser::isWindows() |
bool |
Windows? |
Browser::isLinux() |
bool |
Linux? |
Browser::isMac() |
bool |
macOS or iOS? |
Browser::isAndroid() |
bool |
Android? |
Configuration
In Laravel, publish the config file:
In standalone mode, pass a custom config array:
Available options:
| Key | Default | Description |
|---|---|---|
cache.interval |
10080 |
Cache TTL in seconds |
cache.prefix |
bd4_ |
Cache key prefix |
cache.device-detector |
null |
Cache driver for device-detector's internal cache. See config/browser-detect.php for examples. |
security.max-header-length |
2048 |
Max user agent length (DoS protection) |
Quality
This package aims for 100% test coverage and PHPStan level max with zero baseline errors.
Credits
This package was originally created by Varga Zsolt (hisorange). This fork is maintained by Pieter Willekens (pataar).
Detection is powered by:
- jaybizzle/crawler-detect — Bot and crawler detection
- matomo/device-detector — Comprehensive device, browser, and OS parsing
License
MIT