vuthaihoc/laravel-user-device
Composer 安装命令:
composer require vuthaihoc/laravel-user-device
包简介
A modern Laravel package replacing jenssegers/agent, acting as a wrapper for MobileDetect.
README 文档
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).
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2026-05-26