PHP code example of oleant / laravel-visit-analytics

1. Go to this page and download the library: Download oleant/laravel-visit-analytics 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/ */

    

oleant / laravel-visit-analytics example snippets


'behavioral' => [
    \Oleant\VisitAnalytics\Rules\Behavioral\SpeedAnomalyRule::class => [
        'min_interval_ms' => 250,
        'score'           => 20,
    ],
],

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \Oleant\VisitAnalytics\Http\Middleware\TrackVisits::class,
    ]);
})

use Illuminate\Support\Facades\Schedule;

Schedule::command('visit-analytics:analyze-bots --max=500')->everyTenMinutes();

use Oleant\VisitAnalytics\Models\VisitLog;

// Get latest human visits
$visits = VisitLog::where('is_bot', false)->latest()->paginate(50);

// Get identified bots
$bots = VisitLog::where('is_bot', true)->latest()->get();
bash
php artisan migrate
bash
php artisan vendor:publish --tag="visit-analytics-config" --force