amol/laravel-route-tracker

v0.0.1beta1 2025-07-05 07:35 UTC

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.