Extension allows you to get information about mobile device.
This extension based on Mobile_Detect class.
Requirements ¶
Yii 1.1 or above
Installation ¶
- Download extension from repository https://github.com/iamsalnikov/MobileDetect
- Install into your extension dir (ext.MobileDetect)
- 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();
...
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.
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 usefulAgree
@mastermunj, @Maxxer. Yes, i'll do it.
Fix
@mastermunj, @Maxxer. Fix.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.