PHP code example of pendalf89 / yii2-clientinfo

1. Go to this page and download the library: Download pendalf89/yii2-clientinfo 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/ */

    

pendalf89 / yii2-clientinfo example snippets


'components' => [
    'clientInfo' => 'pendalf89\clientinfo\ClientInfo',
],

/**
 * Class WebApplication
 * Include only Web application related components here
 *
 * @property pendalf89\clientinfo\ClientInfo $clientInfo
 */
class WebApplication extends yii\web\Application
{
}

$isMobile = Yii::$app->clientInfo->isMobile();
$ip = Yii::$app->clientInfo->getIP();
$country = Yii::$app->clientInfo->getCountry();
$isFinland = Yii::$app->clientInfo->isCountry('FI');