PHP code example of skeeks / yii2-mobile-detect

1. Go to this page and download the library: Download skeeks/yii2-mobile-detect library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

skeeks / yii2-mobile-detect example snippets


    'components' => [
        'mobileDetect' => [
            'class' => '\skeeks\yii2\mobiledetect\MobileDetect'
        ]
    ]
    

    echo \Yii::$app->mobileDetect->isMobile();
    echo \Yii::$app->mobileDetect->isTablet();
    echo \Yii::$app->mobileDetect->isDesctop();
    

    //version >= 1.0.1
    echo \skeeks\yii2\mobiledetect\MobileDetect::getInstance()->isMobile();