Documentation

Laravel Feature Heatmap

A zero-setup feature usage tracker and heatmap dashboard for Laravel. Understand which controller actions and routes are being used, by whom, and how often.

What it records

Controller/action, route name, HTTP method, URI, authenticated user identity, timestamps, and daily usage frequency.

Requirements

PHP8.2 or later
Laravel10 or later
DatabaseLaravel-supported driver
OptionalQueue worker for async logging

Installation

Install the package through Composer:

Terminal
composer require farukcoder/laravel-feature-heatmap

The package uses Laravel package auto-discovery, so no manual service provider registration is required.

Publish configuration Optional

php artisan vendor:publish --tag=feature-heatmap-config

Run migrations

php artisan migrate

This creates feature_usage_logs for raw request events and feature_usage_summaries for aggregated daily statistics.

Open the dashboard

After installation and migration, visit:

https://your-app.test/feature-heatmap
Heatmap dashboard

The interface includes heatmap matrices, activity analytics, unused feature discovery, and user tracking.

Automatic global tracking

Automatic tracking is enabled by default. The package attaches its middleware to Laravel's web and api route groups, so no changes are needed in web.php, api.php, or Kernel.php.

Zero-route setup

Once installed, normal application traffic begins producing usage data automatically.

Manual middleware mode

Disable automatic tracking when you only want selected routes included:

FEATURE_HEATMAP_AUTO_TRACK=false

Then apply the named middleware:

Route::middleware(['web', 'auth', 'track.feature'])
    ->group(function () {
        Route::get('/orders', [OrderController::class, 'index']);
    });

Daily aggregation and pruning

For production applications, schedule the aggregation command once per day. It summarizes raw events and can prune old records.

routes/console.php
use Illuminate\Support\Facades\Schedule;

Schedule::command('feature-heatmap:aggregate --prune')
    ->dailyAt('01:00');
app/Console/Kernel.php
protected function schedule(Schedule $schedule): void
{
    $schedule->command('feature-heatmap:aggregate --prune')
        ->dailyAt('01:00');
}

User tracking and CSV reports

The Users Tracking tab lists active users, total hits, distinct features, and last seen time. Open a user to view a feature distribution and timeline heatmap, or download a CSV activity report.

User activity drill-down panel

Configuration

After publishing the configuration file, adjust tracking and dashboard behavior in config/feature-heatmap.php.

return [
    'enabled' => env('FEATURE_HEATMAP_ENABLED', true),
    'auto_track' => env('FEATURE_HEATMAP_AUTO_TRACK', true),
    'use_queue' => env('FEATURE_HEATMAP_USE_QUEUE', true),
    'queue_name' => env('FEATURE_HEATMAP_QUEUE', 'default'),
    'raw_log_retention_days' => 14,

    'excluded_patterns' => [
        '^_debugbar',
        '^horizon',
        '^telescope',
        '^feature-heatmap',
    ],

    'route_prefix' => 'feature-heatmap',
    'route_middleware' => ['web', 'auth'],
    'user_name_column' => 'name',
    'user_email_column' => 'email',
];
enabledTurn all package tracking on or off.
auto_trackAttach middleware automatically to web and API routes.
use_queueWrite events asynchronously through Laravel queues.
raw_log_retention_daysChoose how long raw logs remain before pruning.
excluded_patternsRegex patterns for routes that should never be tracked.
route_middlewareMiddleware protecting the dashboard.

Environment variables

FEATURE_HEATMAP_ENABLED=true
FEATURE_HEATMAP_AUTO_TRACK=true
FEATURE_HEATMAP_USE_QUEUE=false
FEATURE_HEATMAP_QUEUE=default

FEATURE_HEATMAP_AUTH_ENABLED=true
FEATURE_HEATMAP_USERNAME=admin
FEATURE_HEATMAP_PASSWORD=your_secure_password

Dashboard authentication

The package can display its own login screen for the metrics dashboard. Set a strong username and password in your environment and never commit real credentials to source control.

Feature Heatmap dashboard login screen
Production reminder

Protect the dashboard behind HTTPS, application authentication, and authorization appropriate for your team.

Troubleshooting

No activity is appearing

Confirm the package is enabled, automatic tracking is on, migrations ran successfully, and the current URI does not match an excluded pattern.

Queued records are not saved

Start a queue worker or temporarily set FEATURE_HEATMAP_USE_QUEUE=false to verify the rest of the integration.

The dashboard returns 403 or redirects

Review route_middleware, your application authentication state, and the package dashboard authentication environment variables.