Looking to hire Laravel developers? Try LaraJobs

laravel-server-lens maintained by rakibuddin101

Description
Real-time server observability & traffic monitoring dashboard for Laravel.
Author
Last update
2026/05/05 22:22 (dev-main)
License
Links
Downloads
3

Comments
comments powered by Disqus

Laravel Server Lens

Latest Version on Packagist GitHub Tests Action Status Total Downloads License: MIT

A plug-and-play server observability and traffic monitoring dashboard for Laravel. Get live CPU, RAM, disk metrics, service health checks, a real-time request feed with bot detection, and IP blocking — all in one embeddable dashboard with no external services and no build step required.

Dashboard Preview

Installation

You can install the package via Composer:

composer require rakibuddin101/laravel-server-lens

Run the installer to publish config, migrations, and assets:

php artisan server-lens:install

Run the migrations:

php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="server-lens-config"

You can publish the views to customise the dashboard:

php artisan vendor:publish --tag="server-lens-views"

Usage

Visit the dashboard at /ops (or whatever route_prefix you configured):

http://your-app.test/ops

Programmatic access

use Rakib\ServerLens\Facades\ServerLens;

$snapshot = ServerLens::snapshot();    // full metrics, health, and activity
$health   = ServerLens::healthOnly();  // health checks only
$metrics  = ServerLens::metricsOnly(); // CPU, RAM, Disk

Custom health checks

Implement the HealthCheck contract and register it in a service provider:

use Rakib\ServerLens\Contracts\HealthCheck;
use Rakib\ServerLens\Data\CheckResult;

class StripeApiCheck implements HealthCheck
{
    public function name(): string { return 'Stripe API'; }

    public function run(): CheckResult
    {
        $start = microtime(true);
        // your probe logic here
        $ms = round((microtime(true) - $start) * 1000, 2);

        return CheckResult::healthy("Reachable in {$ms} ms", $ms);
    }
}
// In AppServiceProvider::boot()
use Rakib\ServerLens\Facades\ServerLens;

ServerLens::registerCheck(new StripeApiCheck());

Artisan commands

# Run all health checks and print results
php artisan server-lens:check

# Delete traffic logs older than prune_after_days
php artisan server-lens:prune

# Block an IP address (add --hours=N for a temporary block)
php artisan server-lens:block 203.0.113.42
php artisan server-lens:block 203.0.113.42 --hours=24

# Remove an IP block
php artisan server-lens:unblock 203.0.113.42

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.