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.
Architecture fit
Bundle subclass, a DI extension with a Configuration tree, a kernel.request listener that issues redirects to mobile/tablet routes, and view-name switching via a device-view resolver.mobiledetect/mobiledetectlib behind a container binding, and (b) a middleware that performs the redirect. Everything the bundle actually contributes — bundle registration, config tree, event listener wiring, Twig view-name switching — is dead weight in Laravel.mobiledetect/mobiledetectlib (mature, widely used, regex/UA-based). The bundle is a thin, opinionated convenience layer over it. Architectural fit for a Laravel stack is therefore poor for the bundle, acceptable for the underlying library.Integration feasibility
m. subdomain or /mobile routes). If the product is responsive-first, the package solves a problem you do not have.Technical risk
suncat/mobile-detect-bundle), which means the upstream lineage carries the real track record and this repo carries the maintenance tail.composer.json constraint rather than inferring from the major number, since the fork may have renumbered independently.Sec-CH-UA-Mobile) support; v7.0.2 does not add any.Key questions
symfony/http-kernel version constraint?composer.json and check whether the symfony/http-kernel floor conflicts with the version Laravel ships.mobiledetect/mobiledetectlib major does it pin? That library's v4 changed the API surface — and a deprecation-only patch suggests the pin may not have moved.?full_site=1) to break redirect loops? Nothing in v7.0.2 addresses this.suncat/mobile-detect-bundle? Is the fork tracking upstream 7.x, or has it diverged?Stack fit
mobiledetect/mobiledetectlib bound as a singleton/scoped service behind a DeviceDetector interface, orjenssegers/agent (a Laravel-native wrapper over the same Mobile Detect library) if you want the Laravel ergonomics out of the box.kernel.request listener with Laravel middleware; replace the Twig view-name switching with a view-composer or a device view namespace; replace the config tree with config/mobile-detect.php.Migration path
mobiledetect/mobiledetectlib alone; verify detection against a fixture corpus of real UAs from your analytics (iOS Safari, Chrome Android, Facebook IAB, Googlebot-Smartphone, iPadOS 13+ which reports as macOS).DeviceDetector contract with isMobile(), isTablet(), isBot(), preferredView(). Never let the library leak into controllers.Compatibility
symfony/http-kernel and symfony/http-foundation, so the bundle's classes may autoload — but Bundle registration, Extension::load(), and the Configuration tree will never execute. Silent partial functionality is the likely failure mode; guard against it by not installing it at all.composer.json before relying on it, and re-check on the next major since the fork's numbering may not track upstream.Sequencing
alternate/Vary headers) → rollout by traffic slice → measure misdetection and loop rates before full enablement.Maintenance
mobiledetect/mobiledetectlib (actively maintained, broad adoption) and own ~200 lines of your own middleware.Support
Scaling
Failure modes
Vary: User-Agent, or duplicate content across m. and www. without rel=canonical/alternate.Ramp-up
mobiledetect/mobiledetectlib (or jenssegers/agent) directly, own the middleware, and revisit only if the product genuinely requires a separate mobile route/view set — in which case budget for SEO review and a detection-accuracy test corpus before shipping.How can I help you explore Laravel packages today?