1. Go to this page and download the library: Download drsoft28/visitor-tracker 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/ */
drsoft28 / visitor-tracker example snippets
return [
/*
|--------------------------------------------------------------------------
| Model
|--------------------------------------------------------------------------
|
| This value is the model used for tracking visitors.
| By default, it uses the package's built-in model.
| You can replace it with your own model if needed.
*/
'model' => \Drsoft28\VisitorTracker\Models\VisitorTracker::class,
/*
|--------------------------------------------------------------------------
| Headers to Track
|--------------------------------------------------------------------------
|
| Specify the headers to store in the `request_info` JSON column.
| Add or remove headers as needed.
*/
'headers' => [
'HTTP_USER_AGENT',
'HTTP_HOST',
'SERVER_NAME',
'SERVER_SOFTWARE',
'REMOTE_ADDR',
'HTTPS',
],
];
use Drsoft28\VisitorTracker\Models\VisitorTracker;
// Get visitors from the last 5 minutes
$recentVisitors = VisitorTracker::visitorsWithinMinutes(5)->get();