PHP code example of icemix / agent

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

    

icemix / agent example snippets


Icemix\Agent\AgentServiceProvider::class,

'Agent' => Icemix\Agent\Facades\Agent::class,

use Icemix\Agent\Agent;

$agent = new Agent();

$agent->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');
$agent->setHttpHeaders($headers);

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

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

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

$agent->match('regexp');

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

$device = $agent->device();

$platform = $agent->platform();

$browser = $agent->browser();

$agent->isDesktop();

$agent->isPhone();

$agent->isRobot();

$robot = $agent->robot();

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

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