oleant/laravel-visit-analytics
Composer 安装命令:
composer require oleant/laravel-visit-analytics
包简介
Privacy-focused visit analytics for Laravel 10/11/12 with UTM and Referrer tracking.
README 文档
README
Lightweight, privacy-focused visit analytics for Laravel 10, 11, and 12. Track UTM parameters, referrers, and page views while automatically filtering out bots and respecting user privacy.
Features
- Distributed Botnet Protection: (New v2.2) Detects coordinated botnet clusters by analyzing traffic spikes across multiple IPs and cross-referencing with a fingerprint database.
- Modular Analyzer Engine: 12 specialized layers including Botnet Reputation, Behavioral, and Network integrity analysis.
- Smart Bot Detection: Advanced behavioral analysis including Referer-loop detection and page-refresh awareness.
- Bot Scoring System: Assigns a score based on access speed, DNS records, and honeypot hits.
- Retroactive Flagging: Identifies previous visits from an IP once it's confirmed as a bot (Snowball Effect).
- Privacy First: IP anonymization (masks the last octet) enabled by default.
- Cloudflare Ready: Automatically detects real visitor IP via
CF-Connecting-IPheader. - Zero Latency: Logging happens in the
terminatemiddleware after the response is sent to the user.
Installation
Run this command in your terminal (BASH):
composer require oleant/laravel-visit-analytics
Database Setup
Create or update the necessary table by running migrations (BASH):
Important: Version 2.0+ introduces high-precision timing. The
created_atcolumn now uses millisecond precision (timestamp(3)). This is critical for the Behavioral Analyzer to accurately detect ultra-fast automated requests and scripts.
php artisan migrate
Configuration
- analyzers.botnet: Settings for cluster detection thresholds and reputation database weights.
Note for Upgraders (v1.x to v2.0): This version introduces a completely new configuration schema. You must backup your old settings and republish the config file.
Run command (BASH):
php artisan vendor:publish --tag="visit-analytics-config" --force
Key Config Options:
The configuration is now organized by specialized Analyzers:
- analyzers.behavior: Configure request frequency and timing thresholds.
- analyzers.ua: Rules for User-Agent parsing and Client-Hints validation.
- analyzers.network: Settings for DNSBL, PTR records, and IP reputation.
- analyzers.headers: Checks for missing or inconsistent browser headers.
- exclude.ips: List of IP addresses to ignore.
- exclude.paths: URL patterns to skip (e.g., ['admin*', 'api/*']).
Usage
Bot Analysis & Botnet Detection
To perform deep analysis and identify coordinated botnet clusters (BASH):
Run standard analysis and update botnet fingerprints
php artisan visit-analytics:analyze-bots
Middleware Registration
For Laravel 11 & 12, open bootstrap/app.php (PHP):
->withMiddleware(function (Middleware $middleware) { $middleware->web(append: [ \Oleant\VisitAnalytics\Http\Middleware\TrackVisits::class, ]); })
Bot Analysis Command
To perform deep analysis using the new multi-stage engine (BASH):
Analyze last 1000 records (compact log)
php artisan visit-analytics:analyze-bots --max=1000
Analyze last 1000 records with full info
php artisan visit-analytics:analyze-bots --max=1000 --full
It is recommended to schedule this in routes/console.php (PHP):
use Illuminate\Support\Facades\Schedule; Schedule::command('visit-analytics:analyze-bots --max=500')->everyTenMinutes();
Cloudflare Setup & Security
Real IP Detection
The package automatically prioritizes the CF-Connecting-IP header. No extra configuration is needed to see real visitor IPs.
Avoid Self-Banning (WAF Rules)
If you are using Cloudflare WAF, ensure your server's IP is added to the IP Access Rules in the Cloudflare Dashboard to prevent the analysis command from being blocked during DNS/Network checks.
Data Retrieval
To get your stats, just use the Eloquent model (PHP):
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();
License
The MIT License (MIT). Please see LICENSE.md for more information.
Built with ❤️ for Oleant Auditor.
oleant/laravel-visit-analytics 适用场景与选型建议
oleant/laravel-visit-analytics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「laravel」 「privacy」 「UTM」 「visit-log」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oleant/laravel-visit-analytics 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oleant/laravel-visit-analytics 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oleant/laravel-visit-analytics 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Make TYPO3 more compatible to GDPR
Analytics chooser extensions for site settings.
Strips potentially identifying information from outbound requests to the WordPress.org API
Use Klaro! Consent Manager in Contao CMS
A Laravel Nova Card to show Fathom Analytics stats.
This bundle contains functionality concerning privacy and the European Union's "General Data Protection Regulation" (GDPR, in German: "Datenschutz-Grundverordnung", DSGVO).
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 37
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-19