PHP code example of academe / laravel-queue-monitor

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

    

academe / laravel-queue-monitor example snippets


composer 

/*
 * Package Service Providers...
 */
Academe\LaravelQueueMonitor\LaravelQueueMonitorProvider::class,

php artisan migrate



namespace App\Jobs;

use Academe\LaravelQueueMonitor\Jobs\QueueMonitorData;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class ExampleJob implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels, QueueMonitorData;

    protected $results = 0;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $this->results = rand(1, 100);

        $this->saveQueueMonitorData([
            'results' => $this->results,
        ]);

        // ...
    }
}