1. Go to this page and download the library: Download vinou/bot-counter 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/ */
vinou / bot-counter example snippets
use Vinou\BotCounter\BotCounter;
$counter = new BotCounter(__DIR__ . '/var/logs/bots.json');
$counter->count('Googlebot');
use Vinou\BotCounter\BotCounter;
use Vinou\BotCounter\CrawlerDetectAdapter;
$bots = new CrawlerDetectAdapter(new BotCounter(__DIR__ . '/var/logs/bots.json'));
$bots->record(); // counts only if the request came from a crawler
$data = $counter->read();
echo $data['total']; // all visits ever counted
echo $data['bots']['googlebot']['last7days']; // rolling window