https://github.com/xutl/yii2-device-detect
https://github.com/xutl/yii2-device-detect
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/xutl/yii2-device-detect
- Owner: xutl
- License: mit
- Created: 2017-11-28T02:45:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-28T07:00:49.000Z (over 7 years ago)
- Last Synced: 2025-04-23T06:05:35.038Z (about 1 month ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yii2-device-detect
Yii2 extension for [Mobile-Detect](https://github.com/serbanghita/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:
~~~php
'bootstrap' => ['devicedetect'],
'components' => [
'devicedetect' => [
'class' => 'xutl\devicedetect\DeviceDetect'
],
]
~~~You can also use it from anywhere in your code, calling Mobile-Detect's API:
~~~php
/*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/ */
~~~