kitoko/visitor-tracker
最新稳定版本:v1.0.1
Composer 安装命令:
composer require kitoko/visitor-tracker
包简介
A package for tracking visitor on your laravel web site or web application
README 文档
README
A simple and flexible Laravel package to track website visitors and page visits.
1. Installation
composer require kitoko/visitor-tracker
2. Publish the configuration file:
php artisan vendor:publish --tag=visitor-tracker-config
This command will generate
config/visitor-tracker.php
3. Run migration to create the required tables:
php artisan migrate
Confuguration
Edit config/visitor-tracker.php to customize your settings, for example:
return [
'enabled' => true,
'retention_days' => 30,
'cache_minutes' => 10,
];
enableis true by defaultretention_daysis how long yo want to conserve your data (It is 1 month by default)cache minitesis the time you want to keep data in cache
Usage
Once installed, the package will automatically track visitors and page views. You can display visitor statistics in your application using the provided services or helpers.
Display statistics in blade
<div>
Total visitors: {{ \Kitoko\VisitorTracker\Facades\VisitorTracker::total() }}
Today: {{ \Kitoko\VisitorTracker\Facades\VisitorTracker::today() }}
Yesterday: {{ \Kitoko\VisitorTracker\Facades\VisitorTracker::yesterday() }}
</div>
Using in a controller
use Kitoko\VisitorTracker\Facades\VisitorTracker;
public function index()
{
$stats = [
'total' => VisitorTracker::total(),
'today' => VisitorTracker::today(),
'week' => VisitorTracker::week(),
];
return view('dashboard', compact('stats'));
}
Features
- Track unique visitors
- Track page visits
- Daily, weekly, and monthly statistics
- Total visitor counter
- Easy integration with Laravel
Requirements
- PHP ^8.0
- Laravel ^9 | ^10 | ^11 | ^12
Troubleshooting
- Class not found
composer dump-autoload
- Migrations not working? Ensure your
VisitorTrackerServiceProviderhas:
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
License
This package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-15