alikdex/yii2-device-detect
Composer 安装命令:
composer require alikdex/yii2-device-detect
包简介
Yii2 extension for Mobile-Detect library
README 文档
README
Yii2 extension for Mobile-Detect library.
To use it just require this extension in your composer.json file:
"alikdex/yii2-device-detect": "0.0.1",
And then add it to your components configuration in Yii2:
'bootstrap' => ['devicedetect'], 'components' => [ 'devicedetect' => [ 'class' => 'alikdex\devicedetect\DeviceDetect' ], ]
Some basic detections are available in Yii's params:
var_dump(Yii::$app->params['devicedetect']); array (size=3) 'isMobile' => boolean false 'isTablet' => boolean false 'isDesktop' => boolean true
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/ */
统计信息
- 总下载量: 9.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-03