Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Mobile Detect

Laravel Mobile Detect Laravel Package

riverskies/laravel-mobile-detect

Laravel wrapper around the Mobile Detect library that identifies phones, tablets, and desktops from the user agent. Provides a clean facade, Blade directives, and configurable detection so you can serve device-specific views and content with minimal boilerplate.

View on GitHub
Deep Wiki
Context7

Mobile detection within Blade templates

Frequently asked questions about Laravel Mobile Detect
How do I install riverskies/laravel-mobile-detect in a Laravel app?
Install it with Composer using composer require riverskies/laravel-mobile-detect on a disposable branch first. Because the package predates Laravel 6, you may need to manually register the service provider and facade alias in config/app.php rather than relying on package auto-discovery. Run a time-boxed proof of concept on your exact Laravel and PHP versions before rolling it out to real templates.
Which Laravel and PHP versions does riverskies/laravel-mobile-detect support?
The last release was published in September 2017, so the declared constraints target Laravel 5.x-era applications and older PHP versions. There is no evidence of testing against Laravel 6 or later, and Composer conflicts are likely on modern stacks. Always read the composer.json constraints and verify them against your target runtime before adopting it.
How do I use the Mobile Detect facade in Laravel?
The package provides a facade that wraps the Mobile Detect library, so you can call detection methods such as isMobile, isTablet and isDesktop directly in controllers, helpers or views. The exact method names follow the underlying Mobile Detect API, so check the version it depends on. Keep calls centralized behind an internal helper so you can swap the implementation later.
Are there Blade directives for mobile detection in Laravel?
Yes, the package ships Blade directives so you can wrap markup in device-specific blocks instead of writing raw PHP conditionals in your templates. This is convenient for server-rendered device branching but adds compilation surface area that must be re-tested after every Laravel upgrade. Validate that the directives compile cleanly on your target Laravel version before spreading them across many views.
Does riverskies/laravel-mobile-detect detect tablets, bots and desktops, or only mobile?
It is a thin wrapper around Mobile Detect, so it can expose mobile, tablet and desktop classification, and bot detection depends on the underlying library version. Newer device classes and client hints are unlikely to be covered given the 2017 release date. Test mobile, tablet, desktop, bot and spoofed user agents explicitly to confirm what your pinned version actually returns.
Is riverskies/laravel-mobile-detect still maintained and safe for production?
It is effectively unmaintained: the last release dates to 2017, with no upstream security patches, Laravel compatibility updates or user-agent regex refreshes. It is acceptable only as a short-term, low-blast-radius change behind a feature flag in a legacy Blade app. Avoid using it for authorization, routing or any business-critical decision, and name an internal owner for a fork or replacement.
What is a better alternative to laravel-mobile-detect for a modern Laravel app?
For new projects, prefer responsive CSS and progressive enhancement, or evaluate mobiledetect/mobiledetectlib directly with your own thin Laravel service wrapper. Maintained Laravel wrappers, client hints and edge-based device detection are also worth comparing. If you must do server-side branching, centralize it behind an interface so the detection backend can be replaced without touching templates.
How do I test mobile detection and spoofed user agents in Laravel?
Use Laravel's HTTP test helpers to send a specific User-Agent header per request and assert which view or content is returned. Cover at least mobile, tablet, desktop, bot and deliberately spoofed user agents, plus your fallback branch when classification fails. Because user-agent sniffing is brittle, treat these tests as regression guards rather than proof of correctness.
Will user-agent detection break full-page caching in Laravel?
It can. If cached responses are not varied by device class or User-Agent, a mobile layout may be served to desktop visitors or vice versa. Include the detected device class in your cache key or configure a Vary: User-Agent response header, and review cache configuration before adding detection to high-traffic routes. Per-request user-agent parsing itself is cheap; incorrect cache keys are the real risk.
Can I configure the detection rules in riverskies/laravel-mobile-detect?
The package advertises configurable detection, typically via a publishable config file that controls how device classes are resolved. Actual detection accuracy still comes from the bundled Mobile Detect rules, which are frozen at the version you install. Publish the config, document the settings your app relies on, and plan to update or fork the underlying rules if new devices are misclassified.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core