1. Go to this page and download the library: Download atldays/laravel-visitor 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/ */
use Atldays\Visitor\Facades\Visitor;
Visitor::ip();
Visitor::userAgent();
Visitor::language();
Visitor::fingerprint();
Visitor::agent();
Visitor::geo();
use Atldays\Visitor\Facades\VisitorManager;
$visitor = VisitorManager::from(
'8.8.8.8',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36',
[
'language' => 'en-US',
'languages' => ['en-US', 'en'],
],
);
$language = $visitor->language();
$language->language(); // Most preferred language
$language->languages(); // All accepted languages in priority order