amol / laravel-route-tracker
Laraval route tracker
Requires
- php: ^8.3
- illuminate/contracts: ^12.19
- spatie/laravel-package-tools: ^1.92
Requires (Dev)
- larastan/larastan: ^3.5
- laravel/pint: ^1.22
- orchestra/testbench: ^10.4
- pestphp/pest: ^3.8
- pestphp/pest-plugin-arch: ^3.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
This package is auto-updated.
Last update: 2025-07-05 07:36:19 UTC
README
A Laravel package to track and log route usage in your application. Useful for analytics, debugging, and monitoring which routes are accessed and how often.
Features
- Stores route, method, user, and timestamp
- Easy integration with Laravel middleware
- Configurable storage (database, log, etc.)
Installation
Install via Composer:
composer require amol/laravel-route-tracker
Publish the configuration and migration files:
php artisan vendor:publish --provider="Amol\LaravelRouteTracker\RouteTrackerProvider"
Run the migrations:
php artisan migrate
Usage
The package automatically tracks all route hits when the middleware is enabled.
Middleware
Add the middleware to your routes:
Route::middleware(\Amol\LaravelRouteTracker\Middleware\TrackRoute::class)->group(function () { // ...your routes... });
// coming soon Route::middleware(['track.route'])->group(function () { // ...your routes... });
Configuration
You can customize the package by editing the config/route-tracker.php
file after publishing the config.
Options include:
- Enable/disable tracking
- Choose storage driver
- Exclude specific routes or methods (Coming soon)
Viewing Tracked Routes
Tracked route data is stored in the route_logs
table by default. You can query this table or build custom dashboards.
Use Cases
It can be used for storing webhooks called by third-party services, like mailgun, stripe etc, by adding middleware in it.
Testing
Run the package tests with:
composer run test
Contributing
Contributions are welcome! Please submit issues or pull requests.
License
This package is open-sourced software licensed under the MIT license.