PHP code example of nmdimas / yii2-user-agent-parser

1. Go to this page and download the library: Download nmdimas/yii2-user-agent-parser 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/ */

    

nmdimas / yii2-user-agent-parser example snippets


'components' => [
      ...
      'userAgentParser' => [
          'class' => 'yii\useragentparser\UserAgentParser',
          'nameHttpPropertyUserAgent' => 'HTTP_USER_AGENT'
      ],
      ...
  ],

$userAgentInfo = Yii::$app->userAgentParser->getUserAgentObject();

$userAgentInfo = Yii::$app->userAgentParser->getUserAgentObject($userAgent);

 /** @property  \yii\useragentparser\UserAgentParser $userAgentParser */