PHP code example of okatsuralau / cakephp-clientinfo

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

    

okatsuralau / cakephp-clientinfo example snippets


public function initialize()
{
    parent::initialize();

    $this->loadComponent('CakephpClientInfo.ClientInfo');
}

public function index()
{
    // returns the browser name (eg.: Chrome)
    $this->ClientInfo->browser();
    
    // returns the O.S. name (eg.: Linux)
    $this->ClientInfo->os();
    
    // returns the Device name (eg.: Computer, Mobile, Tablet, iPhone, ...)
    $this->ClientInfo->device();
    
    // returns the browser's language (eg.: en)
    $this->ClientInfo->language();
    
    // or you can access the original instance and make calls directly to the browser-detector
    $this->ClientInfo->Browser()->getName();
}