linky/tracker-package
最新稳定版本:v1.1.1
Composer 安装命令:
composer require linky/tracker-package
包简介
Linky tracking package for Laravel
README 文档
README
🔗 Linky Tracker Package
Automatic Link Visit Tracking & Donation Reporting for Laravel
Track visits and donations effortlessly — No JavaScript required!
✨ Features
- 🚀 Zero-Config Visit Tracking — Automatically tracks all GET requests
- 📊 One-Line Donation Reporting — Simple facade for payment tracking
- ⚡ Async Processing — Uses Laravel Queue for optimal performance
- 🔧 Fully Configurable — Customize via environment variables
- 🎯 No JavaScript — Pure server-side tracking
- 🔄 Auto-Registered Middleware — Works immediately after installation
📦 Installation
Option 1: Install from GitHub (Recommended)
Add the repository to your project's composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/spectra10008/linky-tracker.git"
}
],
"require": {
"linky/tracker-package": "^1.0"
}
}
Then install via Composer:
composer require linky/tracker-package:^1.0
Option 2: Install from Packagist (Coming Soon)
composer require linky/tracker-package
⚙️ Configuration
1. Publish Configuration File
Publish the config file to customize settings:
php artisan vendor:publish --tag=config
This will create config/linky.php.
2. Environment Variables
Add these variables to your .env file:
LINKY_ENDPOINT=https://linky.sadah.io/api/webhook LINKY_TOKEN=l76qYiQMpXotwgS6EPU5teFLibROSjXKNlJaChvh
🎯 Usage
Automatic Visit Tracking
No code needed! All GET requests are automatically tracked once the package is installed.
- ✅ Tracks page visits automatically
- ✅ Sends data asynchronously via Laravel Queue
- ✅ No performance impact on your application
Donation Tracking
Report donations with a single line of code:
use Linky; Linky::donation([ 'referral_code' => 'ABC123', 'amount' => 500, 'donor_name' => 'John Doe', 'donor_email' => 'john@example.com', 'transaction_id' => 'TXN123456789', 'payment_method' => 'credit_card', ]);
That's it! No JavaScript, no complex setup — just one line.
🔄 Queue Setup (Recommended)
To ensure tracking doesn't slow down your application:
-
Configure a queue driver in
config/queue.php:QUEUE_CONNECTION=database # or redis
-
Run migrations (if using database queue):
php artisan queue:table php artisan migrate
-
Start the queue worker:
php artisan queue:work
📋 Quick Start Guide
| Step | Command |
|---|---|
| 1. Install | composer require linky/tracker-package:^1.0 |
| 2. Publish Config | php artisan vendor:publish --tag=config |
| 3. Set Environment | Add LINKY_ENDPOINT and LINKY_TOKEN to .env |
| 4. Start Queue | php artisan queue:work |
| 5. Done! | Visits are tracked automatically ✅ |
💡 Example Usage
In Your Controller
<?php namespace App\Http\Controllers; use Linky; class PaymentController extends Controller { public function handlePayment(Request $request) { // Process payment... // Track donation (one line) Linky::donation([ 'referral_code' => $request->referral_code, 'amount' => $request->amount, 'donor_name' => $request->name, 'donor_email' => $request->email, 'transaction_id' => $transaction->id, 'payment_method' => 'stripe', ]); return redirect()->route('thank-you'); } }
🛠️ Requirements
- PHP 7.4 or higher
- Laravel 8.0 to 12.x
- Composer
📄 License
This package is open-sourced software licensed under the MIT license.
Made with ❤️ for the Laravel Community
```统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-20