PHP code example of itxrahulsingh / laravel-monitor

1. Go to this page and download the library: Download itxrahulsingh/laravel-monitor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

itxrahulsingh / laravel-monitor example snippets


return [
    'enabled' => env('MONITOR_ENABLED', true),
    'recorders' => [
        'requests' => ['enabled' => true, 'sample_rate' => 0.1],
        'slow_queries' => ['enabled' => true, 'threshold_ms' => 1000],
        'system' => ['enabled' => true, 'metrics' => ['cpu_usage', 'memory_usage', 'disk_usage']],
    ],
    'notifications' => [
        'channels' => [
            'email' => ['enabled' => true, 'to' => '[email protected]'],
        ],
    ],
    'dashboard' => [
        'route' => '/monitor',
        'middleware' => ['web', 'auth', 'can:view-monitor-dashboard'],
    ],
];

   $schedule->command('monitor:trim')->daily();
   

   $schedule->call(function () {
       (new \Itxrahulsingh\LaravelMonitor\Recorders\SystemMetricsRecorder)->record();
   })->everyMinute();
   
bash
   php artisan vendor:publish --tag=laravel-monitor-config
   
bash
   php artisan vendor:publish --tag=laravel-monitor-migrations
   
bash
   php artisan migrate
   
bash
   php artisan monitor:trim
   
bash
php artisan test