PHP code example of xstreamka / yii2-mobile-detect

1. Go to this page and download the library: Download xstreamka/yii2-mobile-detect library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xstreamka / yii2-mobile-detect example snippets


xstreamka\mobiledetect\Device::$isPhone;

'components' => [
    ...
    'device' => [
        'class' => 'xstreamka\mobiledetect\Device',
        'tablet' => ['SM-T975'], // Array of users' tablets devices.
        'phone' => [] // Array of users' phone devices.
    ],
    ...
]

Device::$isMobile;  // Mobile: Tablet or Phone.
Device::$isTablet;  // Tablet
Device::$isPhone;   // Phone
Device::$isIphone;  // iPhone
Device::$isSamsung; // Samsung
Device::$info;      // About device (HTTP_USER_AGENT)

// Device::$detect === Mobile_Detect()
Device::$detect->isTablet();
Device::$detect->isMobile();
...
Device::$detect->isiOS();
// more here: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples


use xstreamka\mobiledetect\Device;
...

php composer.phar