xutl/yii2-device-detect

The device detect module for Yii.

Installs: 39

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0.0 2017-11-28 04:02 UTC

This package is auto-updated.

Last update: 2022-05-10 21:53:01 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/ */