Real Time Command Line Monitoring With Laravel Top

Laravel Top provides real-time monitoring directly from the command line for Laravel applications. It helps you track critical metrics and see the busiest routes in your application. Since data is stored in Redis, theoretically, the top command output should represent data from all application servers, not just the specific server you run the command from:

php artisan top

Top works by listening to Laravel events and, from those events, displays aggregated data stored in Redis to calculate metrics. Using a TTL, this data is stored for the short term without historical data based on the last five seconds of data.

php artisan top
php artisan top command

These metrics are also available programmatically via the Top facade this package provides:

use Leventcz\Top\Facades\Top;

$requestSummary = Top::http();
$requestSummary->averageRequestPerSecond;
$requestSummary->averageMemoryUsage;
$requestSummary->averageDuration;

The README provides more examples of programmatically accessing data from Redis in your application. On GitHub, you can learn more about this package, get full installation instructions, and view the source code.


The post Real Time Command Line Monitoring With Laravel Top appeared first on Laravel News.

Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.