xutl / yii2-device-detect
The device detect module for Yii.
Installs: 111
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- mobiledetect/mobiledetectlib: ^2.8
- piwik/device-detector: ^3.9
- yiisoft/yii2: ~2.0.6
This package is auto-updated.
Last update: 2024-11-11 03:24:33 UTC
README
Yii2 extension for Mobile-Detect library.
To use it just require this extension in your composer.json
file:
"xutl/yii2-device-detect": "1.0.0",
And then add it to your components configuration in Yii2:
'bootstrap' => ['devicedetect'], 'components' => [ 'devicedetect' => [ 'class' => 'xutl\devicedetect\DeviceDetect' ], ]
You can also use it from anywhere in your code, calling Mobile-Detect's API:
/*Detect a mobile device*/ \Yii::$app->devicedetect->isMobile(); /*Detect a tablet device*/ \Yii::$app->devicedetect->isTablet(); /*Check all available methods here: http://demo.mobiledetect.net/ */