Laravel Route Statistics is a package by @bilfeldt to log stats about users and teams usage of routes in a Laravel application. This package lets you:
- See how much each user uses the application and what part of the application they use
- See if any unauthenticated users are making a lot of requests to your application
Using Laravel's middleware, the package allows you to enable route logging globally, or you can enable it for individual route groups and routes via middleware:
1Route::middleware(['routestatistics'])2 ->get('/example', /* ... */);
Finally, you can even enable logging via a request macro:
1public function index(Request $request)2{3 $request->routeStatistics();4 // ...5 return view('example');6}
This package logs requests to the database with the following fields by default:
user_id
- the user id if authenticatedteam_id
- the team id associated with the request (if available)method
- the HTTP methodroute
- the route name (if available) or the route URIstatus
- the HTTP status codeip
- the request IPdate
- the date of the request stored as a datetime
You can learn more about this package, get full installation instructions, and view the source code on GitHub.
0 comments:
Post a Comment
Thanks