jalismahamud / traffic-analytics
A Laravel package for traffic and activity logging with analytics dashboard
Package info
github.com/Jalismahamud/traffic-analytics
Language:Blade
pkg:composer/jalismahamud/traffic-analytics
Requires
- php: ^8.1
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/http: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
README
Laravel Traffic Analytics
A powerful, plug-and-play Laravel package for tracking, analyzing, and visualizing your application's HTTP traffic — with a beautiful real-time dashboard, dark mode, CSV export, and zero configuration required.
Features
- Automatic HTTP Traffic Logging via middleware — zero manual code needed
- Beautiful Analytics Dashboard with real-time charts (Chart.js)
- Dark Mode support with toggle
- Flexible Date Filtering — Today, Last 7 Days, Last 30 Days, Custom Range
- Traffic Over Time line chart with Avg Response Time overlay
- Status Code Distribution doughnut chart (2xx / 3xx / 4xx / 5xx)
- Top Visited URLs with popularity bar chart
- HTTP Method Distribution pie chart (GET / POST / PUT / DELETE)
- Top IP Addresses with hit count
- Recent Requests live log table
- CSV Export for any date range
- Auto-refresh every 15 seconds
- Response Caching for high-traffic sites
Screenshots
Dashboard Overview — Light Mode
Dashboard Overview — Dark Mode
Top Visited URLs & HTTP Methods
Top URLs Table
Recent Requests & Top IPs
Installation
Step 1 — Install via Composer
composer require jalismahamud/traffic-analytics
Step 2 — Publish Config & Run Migration
php artisan vendor:publish --tag=traffic-analytics-config php artisan migrate
Done!
Visit your dashboard at:
/admin/traffic
The middleware registers automatically. No extra route or kernel changes needed.
Configuration (Optional)
Publish the config file to customize behavior:
php artisan vendor:publish --tag=traffic-analytics-config
Dashboard Sections
| Section | Description |
|---|---|
| Metric Cards | Total requests, unique visitors, avg response time, error rate, today's stats |
| Traffic Over Time | Line chart showing request volume and avg response time per hour/day |
| Status Distribution | Doughnut chart — 2xx success, 3xx redirects, 4xx client errors, 5xx server errors |
| Top Visited URLs | Horizontal bar chart of most-hit endpoints |
| HTTP Methods | Pie chart breakdown of GET, POST, PUT, PATCH, DELETE |
| Top URLs Table | Tabular view with hits, avg response time, and popularity bar |
| Recent Requests | Live scrollable log of latest requests with method, status, IP, timing |
| Top IP Addresses | Most active IPs with request count and visual bar |
Database Schema
The package creates a single traffic_logs table:
| Column | Type | Description |
|---|---|---|
id |
bigint |
Auto-increment primary key |
url |
text |
Full request URL |
method |
varchar(10) |
HTTP method (GET, POST, etc.) |
ip_address |
varchar(45) |
Client IP (supports IPv6) |
status_code |
smallint |
HTTP response status code |
response_time |
float |
Response time in milliseconds |
user_id |
bigint |
Authenticated user ID (nullable) |
user_agent |
text |
Browser user agent string |
referrer |
text |
HTTP referrer header |
created_at |
timestamp |
When the request was logged |
Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.1 |
| Laravel | ^10.0 | ^11.0 | ^12.0 |
| Database | MySQL / MariaDB (uses DATE_FORMAT) |
Uninstalling
php artisan migrate:rollback --path=vendor/jalismahamud/traffic-analytics/database/migrations composer remove jalismahamud/traffic-analytics
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/my-feature - Open a Pull Request
License
This package is open-source software licensed under the MIT License.
Made with ❤️ for the Laravel community




