muhammad-nawlo / route-tracker
Track usage and hits of Laravel routes automatically with this simple package.
Fund package maintenance!
Requires
- php: ^8.0
- ext-json: *
- illuminate/console: ^10.0 || ^11.0 || ^12.0
- illuminate/support: ^10.0 || ^11.0 || ^12.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^10.4
- pestphp/pest: ^3.8
- phpstan/phpstan: ^2.1
- spatie/ray: ^1.28
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Find out which routes in your Laravel app are actually used. Route Tracker counts hits and records the last-used time for every route, so you can spot dead endpoints before you delete or refactor them.
Features
- Zero setup: the middleware registers itself on the
webgroup - Records hit count and last-used timestamp per route (route name, or path for unnamed routes)
- Stores data as JSON on your default filesystem disk, so it works with local storage, S3 and any other Laravel disk
php artisan route:usageprints a usage table- Switch it off with one environment variable
- Supports Laravel 10, 11 and 12 on PHP 8.0+
Installation
composer require muhammad-nawlo/route-tracker
The service provider is auto-discovered. Optionally publish the config:
php artisan vendor:publish --provider="MuhammadNawlo\RouteTracker\RouteTrackerServiceProvider" --tag=config
Usage
Browse your app as normal, then run:
php artisan route:usage
+-----------------+------+---------------------+
| Route | Hits | Last Used |
+-----------------+------+---------------------+
| dashboard | 42 | 2026-10-08 14:03:11 |
| profile.edit | 7 | 2026-10-07 09:12:45 |
| reports/export | 1 | 2026-09-30 17:40:02 |
+-----------------+------+---------------------+
The raw data lives in route-usage.json on the default disk.
To track API routes too, add the middleware to the api group yourself:
// bootstrap/app.php (Laravel 11+) ->withMiddleware(function (Middleware $middleware) { $middleware->api(append: [ \MuhammadNawlo\RouteTracker\Middleware\TrackRouteUsage::class, ]); })
Configuration
// config/route-tracker.php return [ 'enabled' => env('ROUTE_TRACKER_ENABLED', true), ];
Set ROUTE_TRACKER_ENABLED=false to turn tracking off.
Every request reads and writes one JSON file, so the package is best suited to development, staging and low-to-medium traffic apps.
Testing
composer test
Changelog
See CHANGELOG.md.
License
MIT. See LICENSE.md.