Yii 1.1: mobiledetect

Get information about mobile device
24 followers

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

Requirements

Yii 1.1 or above

Installation

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

Usage

This extension support all methods from Mobile_Detect Class.

$detect = Yii::app()->mobileDetect;
// call methods
$detect->isMobile();
$detect->isTablet();
$detect->isIphone();
...

Total 4 comments

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

@mastermunj, @Maxxer. Fix.

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

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

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

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: +14
  • Downloaded: 826 times
  • Created on: Jan 16, 2013
  • Last updated: Oct 5, 2013