PHP code example of commencement.technology / botcheck

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

    

commencement.technology / botcheck example snippets


use CommencementTechnology\Botcheck\BotChecker;

// $ua = $request->get('ua'); 
//              OR
// $ua = $_SERVER['HTTP_USER_AGENT']; 
$ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:81.0) Gecko/20100101 Firefox/81.0';

$user_agent      = new BotChecker($ua);

// If you want all data in that case just use parse
$user_agent_info = $user_agent->parse();

[
	'os' => [
		'name'    => 'Windows',
		'icon'    => 'win10',
		'version' => '10'
	],
	'browser' => [
		'name'    => 'Firefox',
		'icon'    => 'firefox',
		'version' => '86.0'
	],
	'hardware' => false,
	'misc' => false,
	'bot' => false
];

// When you want only Operating system specific details pass as 
$user_agent_os   = $user_agent->parse('os');

[
	'name'    => 'Windows',
	'icon'    => 'win10',
	'version' => '10'
];

// When you want only bot or crawler specific details pass as 
$user_agent_os   = $user_agent->parse('bot');

[
	'name'    => 'SEMRush Crawler',
	'website'    => 'http://www.semrush.com',
	'complete_link' => 'http://www.semrush.com/bot.html'
];