i4erkasov / yii2-device-detect
Device Detect extension for Yii2
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: ^7.0
- mobiledetect/mobiledetectlib: ^2.8
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-12-20 22:44:03 UTC
README
Device Detect extension for Yii2"
Installation
The preferred way to install this extension is through composer.
Run the following command
php composer.phar require --prefer-dist i4erkasov/yii2-device-detect "*"
or add the following to the require section of your composer.json file:
"i4erkasov/yii2-device-detect": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
-
Add
mobileDetect
component to your Yii2 configuration like this:'components' => [ 'device' => [ 'class' => '\i4erkasov\devicedetect\DeviceDetect' ] ]
-
Use
DeviceDetect
component as Mobile_Detect PHP class:echo \Yii::$app->device->isMobile(); echo \Yii::$app->device->isTablet(); echo \Yii::$app->device->isDesktop();