2017 © Pedro Peláez
 

library yii-detectmobilebrowser

Handles detecting mobile browsers

image

marcovtwout/yii-detectmobilebrowser

Handles detecting mobile browsers

  • Monday, October 23, 2017
  • by marcovtwout
  • Repository
  • 1 Watchers
  • 4 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

yii-detectmobilebrowser

Handles detecting mobile browsers. Results are stored locally for caching calls within the same request, and stored in a cookie for caching across requests., (*1)

Detection regex used from http://detectmobilebrowsers.com/, (*2)

Requirements

Tested on Yii 1.1.8 - 1.1.14, should work on all versions., (*3)

Installation

Install as an application component, in your config:, (*4)

'components' => array(
   'detectMobileBrowser' => array(
       'class' => 'ext.yii-detectmobilebrowser.XDetectMobileBrowser',
       //'secure' => true,
       //'httpOnly' => true,
    ),
),

Usage

You can get the current user preference like this:, (*5)

if (Yii::app()->detectMobileBrowser->showMobile) {
    // do something
}

By default it will use the automatically detected value. You can also set the preference yourself like this:, (*6)

public function actionShowMobile() {
    Yii::app()->detectMobileBrowser->showMobile = true;
    $this->redirect(array('/site/index'));
}

The Versions

23/10 2017

dev-master

9999999-dev

Handles detecting mobile browsers

  Sources   Download

23/10 2017

1.3.0

1.3.0.0

Handles detecting mobile browsers

  Sources   Download