We are going to deploy the new yiiframework.com website on March 23, 2018 from 8:00 to 12:00 UTC.
Website and Yii documentation will not be available in this time frame. Check the news for more details.

Yii 1.1: mobiledetect

Get information about mobile device

Extension allows you to get information about mobile device.
This extension based on Mobile_Detect class.


Yii 1.1 or above


  1. Download extension from repository https://github.com/iamsalnikov/MobileDetect
  2. Install into your extension dir (ext.MobileDetect)
  3. Include component
    'mobileDetect' => array(
        'class' => 'ext.MobileDetect.MobileDetect'


This extension support all methods from Mobile_Detect Class.

$detect = Yii::app()->mobileDetect;
// call methods

Total 4 comments

#15865 report it
IAmSalnikov at 2013/12/24 12:59pm

@mastermunj, @Maxxer. Fix.

#15811 report it
IAmSalnikov at 2013/12/19 03:37am

@mastermunj, @Maxxer. Yes, i'll do it.

#15810 report it
Maxxer at 2013/12/19 03:21am

As @mastermunj said it's probably better to leave the original library intact, for upgrade purposes. Just doing something like copying the original MobileDetect.php in protected/components/ and use MobileDetect itself is better than this. Also I don't see much Yii-fication in this library. You should implement something like detectmobilebrowser, which allows calls like ->showMobile directly. This would be useful

#11501 report it
mastermunj at 2013/01/17 03:36am
Separate component class

Nice extension, but wouldn't it be good to have separate component class which handles Yii integration keeping the original Mobile_Detect class intact? Thus users can always update original file whenever they need rather than being dependent on this extension.

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: MIT License
  • Developed by: IAmSalnikov
  • Category: Others
  • Votes: +15
  • Downloaded: 1,355 times
  • Created on: Jan 16, 2013
  • Last updated: Oct 5, 2013