Skip to content

i4erkasov/yii2-device-detect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

yii2-device-detect

Latest Stable Version Total Downloads License

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 :

  1. Add mobileDetect component to your Yii2 configuration like this:

    'components' => [
        'device' => [
            'class' => '\i4erkasov\devicedetect\DeviceDetect'
        ]
    ]
  2. Use DeviceDetect component as Mobile_Detect PHP class:

    echo \Yii::$app->device->isMobile();
    echo \Yii::$app->device->isTablet();
    echo \Yii::$app->device->isDesktop();

About

Device Detect extension for Yii2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages