vuthaihoc / laravel-user-device
There is no license information available for the latest version (v1.0.0) of this package.
A modern Laravel package replacing jenssegers/agent, acting as a wrapper for MobileDetect.
v1.0.0
2026-05-26 09:16 UTC
Requires
- php: ^8.2
- illuminate/support: ^12.0|^13.0
- mobiledetect/mobiledetectlib: ^4.0
README
A modern Laravel package replacing jenssegers/agent, acting as a lightweight wrapper around mobiledetect/mobiledetectlib v4. It maintains backwards compatibility with \Agent::... calls by providing the same facade methods.
Requirements
- PHP >= 8.2
- Laravel 12.0 or 13.0+
mobiledetect/mobiledetectlib^4.0
Installation
You can install the package via composer:
composer require vuthaihoc/laravel-user-device
Configuration
The package automatically registers its ServiceProvider and Facade thanks to Laravel Package Discovery. No additional configuration is needed.
Usage
You can use the \Agent facade directly in your Laravel application just like you did with jenssegers/agent:
// Basic device detection $device = \Agent::device(); // Returns device name or false $robot = \Agent::robot(); // Returns robot name or false // MobileDetect methods (forwarded dynamically) \Agent::isMobile(); \Agent::isTablet(); \Agent::is('iPhone'); \Agent::getUserAgent(); // Legacy methods compatibility \Agent::getBrowsers(); \Agent::getOperatingSystems(); \Agent::getPlatforms(); \Agent::getDesktopDevices(); \Agent::getDetectionRulesExtended(); \Agent::getScriptVersion();
Included Compatibility Methods
This package implements or forwards the following methods to ensure a smooth transition from jenssegers/agent:
device()robot()getDetectionRulesExtended()getBrowsers()getOperatingSystems()getPlatforms()getDesktopDevices()getProperties()getScriptVersion()getPhoneDevices()getTabletDevices()getUserAgents()getUtilities()getMobileDetectionRules()
License
The MIT License (MIT).