PHP code example of nyx-solutions / yii2-nyx-user-agent-parser

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

    

nyx-solutions / yii2-nyx-user-agent-parser example snippets


use nyx\components\http\userAgent\Parser;

$userAgent = UserAgentParser::parse(); // or UserAgentParser::parse($ua);

$userAgent->ua;                 // [Searched UserAgent]
$userAgent->successfullyParsed; // [Has UserAgent Results]
$userAgent->platform;           // [Detected Platform]
$userAgent->browser;            // [Detected Browser]
$userAgent->version;            // [Detected Browser Version]

use nyx\components\http\userAgent\Parser;

$userAgent = new UserAgentParser();

$userAgent->ua;                 // [Searched UserAgent]
$userAgent->successfullyParsed; // [Has UserAgent Results]
$userAgent->platform;           // [Detected Platform]
$userAgent->browser;            // [Detected Browser]
$userAgent->version;            // [Detected Browser Version]