rmunate/agent-detection
rmunate/agent-detection is a lightweight PHP/Laravel package that parses the User-Agent to identify the browser, operating system, device type, and whether a visitor is a bot or crawler. Simple, fast API with no external service calls.
This package answers a narrow but recurring product question: "What is this request coming from, and should the experience differ because of it?" It exposes user-agent details — mobile vs. desktop, Android vs. iOS, and whether the caller is a bot/crawler/spider — behind a simple Composer-installable Laravel-friendly API.
Concrete decisions it can inform:
What this release actually tells us: v1.7.0's notes are essentially a README restatement — no changelog, no migration notes, no breaking-change markers, no stated pattern-database updates. Treat the version bump as iteration on packaging and documentation rather than a substantiated capability change, and validate the actual detection surface against real traffic before betting roadmap on it.
Adopt it when most of the following hold:
DeviceContext) so the vendor choice is swappable.Look elsewhere — or build the three regexes yourself — when:
device-detector, Browscap, or 51Degrees/WURFL-class data sets are the appropriate comparison, and the trade-off is size and update cadence.Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform) plus client-side feature detection and CSS media queries are the more durable mechanism; server-side UA parsing is increasingly a fallback.Non-negotiable pairing: responsive design first, this package second. Device detection should select variants, not replace a layout that already adapts.
To executives (one paragraph): We can ship device- and OS-aware experiences — targeted app-install prompts, tailored onboarding, desktop-vs-mobile menus — for roughly the cost of a Composer dependency. It is MIT-licensed, runs in-process with no vendor contract, no third-party API, and no data leaving our infrastructure, so privacy and procurement review are light. The same capability lets us filter bot traffic out of product analytics, which improves the trustworthiness of numbers we already report on. The honest framing: this is a small, fast, low-cost optimization lever, not a platform investment, and it carries single-maintainer dependency risk that we contain by wrapping it behind our own interface and pinning the version.
To engineering (the ask): Install rmunate/agent-detection, then immediately hide it behind a thin DeviceContext abstraction with three or four methods (isMobile, isIOS, isAndroid, isBot). Add contract tests with a fixture corpus of real and adversarial UA strings, plus fallbacks for empty or malformed headers. Log detected agent class alongside existing request telemetry for one sprint before any UX depends on it, so we can measure false-positive/negative rates on our actual traffic. Keep the abstraction swappable to Matomo device-detector or Client Hints — that is our exit ramp and our argument for why this dependency is low-risk. Do not use it as an authorization or rate-limiting control. Pin the version, watch upstream releases, and re-review when the changelog becomes substantive.
Success measures: lift in mobile-to-app hand-off rate, conversion delta on OS-specific flows, reduction in bot contamination of funnel metrics, and zero incidents attributable to misclassification.
How can I help you explore Laravel packages today?