PHP code example of omaralalwi / laravel-jobs-metrics

1. Go to this page and download the library: Download omaralalwi/laravel-jobs-metrics 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/ */

    

omaralalwi / laravel-jobs-metrics example snippets




namespace App\Jobs;

use Omaralalwi\JobsMetrics\Traits\HasJobsMetricTracker;

class ProcessPodcast implements ShouldQueue
{
    use HasJobsMetricTracker;

    // Your job implementation...
}

return [
    // Enable or disable metrics tracking globally
    'track_jobs_metrics' => (bool) env('TRACK_JOBS_METRICS', true),
    // Log errors that occur during metrics tracking
    'log_errors' => (bool) env('JOBS_METRICS_LOG_ERRORS', true),
];

Schedule::command('jobs-metrics:cleanup')->weekly();
bash
php artisan vendor:publish --provider="Omaralalwi\JobsMetrics\JobsMetricsServiceProvider" --tag="config"
bash
php artisan migrate
bash
# View job metrics with default options
php artisan jobs-metrics:top
# Customize display options
php artisan jobs-metrics:top --limit=20 --sort=time --days=2
bash
php artisan jobs-metrics:cleanup
bash
php artisan jobs-metrics:cleanup --days=5