Yii 2.0: yii2-mobile-detect

This extension provides an Yii2 component wrapper for Mobile_Detect PHP class and...
4 followers

Installation

This extension provides an Yii2 component wrapper for Mobile_Detect PHP class and can be used to detect whether a device is mobile one in your Yii2 application.

Either run

php composer.phar require skeeks/yii2-mobile-detect "*"

or add

"skeeks/yii2-mobile-detect": "*"

Usage

'components' => [
    'mobileDetect' => [
        'class' => '\skeeks\yii2\mobiledetect\MobileDetect'
    ]
]
var_dump(\Yii::$app->mobileDetect->isMobile());
var_dump(\Yii::$app->mobileDetect->isTablet());
var_dump(Yii::$app->mobileDetect->isDesctop());
 
//version >= 1.0.1
echo \skeeks\yii2\mobiledetect\MobileDetect::getInstance()->isMobile();

Resources

Total 2 comments

#20050 report it
cgsmith at 2017/03/17 12:04pm
re alexandernst

Thanks for posting! I'll be utilizing yours and contributing to yours.

#19503 report it
alexandernst at 2015/08/07 09:10am
Absurd copy

I can't really see why you copied my extension (alexandernst/yii2-mobile-detect), changed its name and published it as yours. You didn't change a single bit, except the credits at the top of the file.

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet