PHP code example of vietstars / client-detect

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

    

vietstars / client-detect example snippets


Vietstars\ClientDetect\ClientServiceProvider::class,

'Client' => Vietstars\ClientDetect\Facades\Client::class,

use Vietstars\ClientDetect\Client;

$client = new Client();

$client->setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2');
$client->setHttpHeaders($headers);

$client->is('Windows');
$client->is('Firefox');
$client->is('iPhone');
$client->is('OS X');

$client->isAndroidOS();
$client->isNexus();
$client->isSafari();

$client->isMobile();
$client->isTablet();

$client->match('regexp');

$languages = $client->languages();
// ['nl-nl', 'nl', 'en-us', 'en']

$device = $client->device();

$platform = $client->platform();

$browser = $client->browser();

$client->isDesktop();

$client->isPhone();

$client->isRobot();

$robot = $client->robot();

$browser = $client->browser();
$version = $client->version($browser);

$platform = $client->platform();
$version = $client->version($platform);