netbull/mobile-detect-bundle
Symfony bundle integrating Mobile Detect to identify phones, tablets, and desktop browsers. Provides services and Twig helpers for device-aware templates, redirects, and responsive behavior in Laravel-style PHP apps.
mobiledetect/mobiledetectlib (MIT, widely used). The real build-vs-buy decision is "hand-roll UA parsing in middleware" vs. "depend on a maintained regex table" — and the library wins that. The bundle adds Symfony DI wiring, Twig helpers, and redirect config; that's convenience, not capability.mobiledetectlib directly inside a middleware plus a view-hint binding — roughly 150–250 lines — or pick a maintained Laravel-specific wrapper. Adopting this bundle in a Laravel app means porting it, which is strictly worse than depending on the library.Sec-CH-UA-Mobile where available.Reasonable fits:
Vary: User-Agent handling, and the redirect rules yourself.Look elsewhere or don't use it:
Sec-CH-UA-Mobile / Sec-CH-UA-Platform Client Hints on Chromium for server-side branching — with Accept-CH negotiation and a fallback.Vary/redirect-loop risk. Google has moved to mobile-first indexing; an m-dot is a long-term maintenance liability rather than an advantage.Practical adoption checklist: verify Symfony major compatibility → confirm the underlying mobiledetectlib version and its update cadence → write tests around caching/Vary and redirect loops → decide bot/crawler handling (you almost certainly want crawlers to see the canonical desktop URL) → confirm who owns the fork if the maintainer stops.
For executives: This is small plumbing, not a platform bet. It only earns a place if we are keeping a legacy Symfony application that already runs a separate mobile site — in that case it is the cheapest way to keep redirects and mobile views working while we modernize. For anything new, responsive design plus Client Hints covers the same need without adding user-agent sniffing to the request path, and without inheriting an m-dot we have to maintain forever. Adoption cost is near zero; ownership cost is the real line item, so the recommendation is: use it only inside the legacy scope, time-boxed, with an exit plan. Do not let it spread into new surface area.
For engineering: It is a thin Symfony bundle over mobiledetect/mobiledetectlib — DI service, Twig helper, config-driven host/view switching and redirects. It is Symfony ≤5 only; there is no Laravel integration, so for our Laravel services the plan is the library plus a middleware, not this package. If we do adopt it, pin the version, vendor or fork it (1 star, 0 dependents, single maintainer — no upstream safety net), ensure crawlers always receive the canonical URL, and add explicit tests for Vary: User-Agent and cache behavior, since that is where mobile redirects typically break. Treat UA detection as a hint that degrades gracefully, never as the sole gate for content or entitlements.
How can I help you explore Laravel packages today?