bilfeldt/laravel-route-statistics
Logs Laravel route usage statistics by recording and aggregating requests/responses per route, user, and timeframe (hour/day/month) to minimize database storage. Helps spot heavy users, high-traffic endpoints, and suspicious unauthenticated activity.
bilfeldt/laravel-request-logger v3+), database requirements, or queue support.| Risk Area | Assessment | Mitigation |
|---|---|---|
| PHP 8.5 Migration | Low risk: No breaking changes. Apps using PHP 8.5 can upgrade seamlessly. | Test with php -v and composer require to validate compatibility. |
| DB Bloat | Unchanged. Aggregation and TTL strategies remain the primary mitigations. | Continue using route:unused and Model Observers for purging. |
| Middleware Order | Unchanged. Early placement in the stack (e.g., before auth) is still critical. | Document middleware order in team runbooks. |
| Context Data Leakage | Unchanged. Custom context validation remains a manual responsibility. | Use Laravel’s tap() or middleware validation. |
| Query Performance | Unchanged. Artisan commands may still slow during peak usage. | Cache results (Redis) or run during off-peak hours. |
| Upgrade Path | Simplified: PHP 8.5 support reduces future friction for teams adopting newer Laravel versions (e.g., 12+). | Prioritize upgrades to Laravel 12+ for full feature parity. |
| Phase | Action | Tools/Commands |
|---|---|---|
| PHP 8.5 Validation | Test the package in a staging environment with PHP 8.5. Verify no regressions. | php -v, composer require bilfeldt/laravel-route-statistics:^4.4.0. |
| Pilot Deployment | Deploy to a non-production Laravel 12+ instance with PHP 8.5. Monitor DB/performance. | Same as before: php artisan vendor:publish --tag=migrations, then migrate. |
| Gradual Rollout | Migrate route groups (e.g., api, admin) to PHP 8.5 + v4.4.0. Use feature flags for selective logging. |
Update Kernel.php or route groups incrementally. |
| Full Adoption | Upgrade all environments to PHP 8.5 + Laravel 12+ (if applicable). Leverage PHP 8.5’s performance benefits. | composer update, php artisan optimize. |
| Optimization | Benchmark latency with PHP 8.5 using tools like Blackfire or Laravel Debugbar. | Compare pre/post-upgrade metrics. |
auth()->user() behavior.X-Forwarded-For is trusted for IP logging (unchanged).$this->middleware(RouteStatisticsMiddleware::class)->handle($request);
bilfeldt/laravel-request-logger:^4.4.0.route:stats.route_statistics table with no breaking schema changes.php -r "echo PHP_VERSION;".php artisan route:stats --help for command validation.ROUTE_STATISTICS_QUEUE=true) remains the recommended scaling strategy.| Scenario | Impact | Mitigation |
|---|---|---|
| PHP 8.5 Regression | Rare, but possible if using experimental features. | Roll back to PHP 8.4 via composer require php:^8.4. |
| Middleware Misplacement | Logging unauthenticated routes inconsistently. | Audit Kernel.php middleware order. Use Route::middleware(['routestatistics'])->group(...) for precision. |
| DB Connection Issues | Que |
How can I help you explore Laravel packages today?