PHP code example of karmendra / laravel-agent-detector

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

    

karmendra / laravel-agent-detector example snippets


Karmendra\LaravelAgentDetector\AgentDetectorServiceProvider::class,

'AgentDetector' => Karmendra\LaravelAgentDetector\Facades\AgentDetector::class,

use Karmendra\LaravelAgentDetector\AgentDetector;

$user_agent = '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';
$ad = new AgentDetector($user_agent);

$ad->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');

$type = $ad->device();

$brand = $ad->deviceBrand();

$model = $ad->deviceModel();

$platform = $ad->platform();

$platform_version = $ad->platformVersion();

$browser = $ad->browser();

$browser_version = $ad->browserVersion();

$ad->isBot();