PHP code example of ccarver / queue-watcher-laravel

1. Go to this page and download the library: Download ccarver/queue-watcher-laravel 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/ */

    

ccarver / queue-watcher-laravel example snippets


Schedule::command('model:prune')->daily();

use Ccarver\QueueWatcher\Models\WatchedMail;

// All sent mail, newest first
WatchedMail::latest()->get();

// Mail sent to a specific address
WatchedMail::where('to', 'like', '%[email protected]%')->get();

'mail' => [
    'enabled'          => env('QUEUE_WATCHER_MAIL_ENABLED', true),
    'prune_after_days' => env('QUEUE_WATCHER_MAIL_PRUNE_DAYS', 7),
],
bash
php artisan vendor:publish --tag=queue-watcher-config
json
{"telemetry":true,"status":"reserved","job_id":"1","job_name":"App\\Jobs\\MyJob","error":null,"time":"2026-01-01T00:00:00+00:00"}
{"telemetry":true,"status":"completed","job_id":"1","job_name":"App\\Jobs\\MyJob","error":null,"time":"2026-01-01T00:00:01+00:00"}
{"telemetry":true,"status":"failed","job_id":"2","job_name":"App\\Jobs\\MyJob","error":"Timeout","time":"2026-01-01T00:00:05+00:00"}
bash
php artisan vendor:publish --tag=queue-watcher-migrations
php artisan migrate
bash
php artisan model:prune
bash
php artisan vendor:publish --tag=queue-watcher-migrations
php artisan migrate