The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

Laravel Top

leventcz/laravel-top image

Laravel Top stats

Downloads
22
Stars
73
Open Issues
0
Forks
1

View on GitHub →

Real-time monitoring straight from the command line for Laravel applications.

Real-time monitoring with Laravel Top

php artisan top

Top provides real-time monitoring directly from the command line for Laravel applications. It is designed for production environments, enabling you to effortlessly track essential metrics and identify the busiest routes.

How it works?

Top listens to Laravel events and saves aggregated data to Redis hashes behind the scenes to calculate metrics. The aggregated data is stored with a short TTL, ensuring that historical data is not retained and preventing Redis from becoming overloaded. During display, metrics are calculated based on the average of the last 5 seconds of data.

Installation

Compatible with Laravel 10, Laravel 11, and Laravel Octane.

Requires PHP 8.2+ | Redis 5.0+

composer require leventcz/laravel-top

Configuration

By default, Top uses the default Redis connection. To change the connection, you need to edit the configuration file.

You can publish the config file with:

php artisan vendor:publish --tag="top"
<?php
 
return [
/*
* Provide a redis connection from config/database.php
*/
'connection' => env('TOP_REDIS_CONNECTION', 'default')
];

Facade

If you want to access metrics in your application, you can use the Top facade.

<?php
 
use Leventcz\Top\Facades\Top;
use Leventcz\Top\Data\Route;
 
$requestSummary = Top::http();
$requestSummary->averageRequestPerSecond;
$requestSummary->averageMemoryUsage;
$requestSummary->averageDuration;
 
$databaseSummary = Top::database();
$databaseSummary->averageQueryPerSecond;
$databaseSummary->averageQueryDuration;
 
$cacheSummary = Top::cache();
$cacheSummary->averageHitPerSecond;
$cacheSummary->averageMissPerSecond;
$cacheSummary->averageWritePerSecond;
 
$topRoutes = Top::routes();
$topRoutes->each(function(Route $route) {
$route->uri;
$route->method;
$route->averageRequestPerSecond;
$route->averageMemoryUsage;
$route->averageDuration;
})

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

License

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

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Leventcz Laravel Top Related Articles

RedBerry to Host Georgia's First Laravel Meetup in Tbilisi image

RedBerry to Host Georgia's First Laravel Meetup in Tbilisi

Read article
Axios npm Package Compromised With Remote Access Trojan image

Axios npm Package Compromised With Remote Access Trojan

Read article
SlideWire: Build Presentations with Livewire and Blade image

SlideWire: Build Presentations with Livewire and Blade

Read article
Laravel Pint Now Replaces Fully Qualified Class Names with Imports image

Laravel Pint Now Replaces Fully Qualified Class Names with Imports

Read article
Filament through the years image

Filament through the years

Read article
Why Your Livewire Dashboard Jumps (And How to Fix It) - Laravel In Practice EP18 image

Why Your Livewire Dashboard Jumps (And How to Fix It) - Laravel In Practice EP18

Read article
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
DreamzTech logo

DreamzTech

Hire 6-10+ Yrs. experienced skilled Laravel Developers from DreamzTech. We ensure NDA protected, 100% quality delivery. Contact Us & Discuss Your Need.

DreamzTech
The Certification of Competence for Laravel logo

The Certification of Competence for Laravel

A community-driven, proctored assessment across 4 levels designed to validate real-world Laravel knowledge, from Junior to mastery-level Artisan. Official Vue.js, Official Nuxt, Angular, React, JS certifications also available.

The Certification of Competence for Laravel
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit