PHP Classes

How to Implement a PHP Queue Management System with Laravel Illuminate Queue using the Package Scheduler: Queue jobs to be executed by worker tasks

Recommend this page to a friend!
  Info   View files Example   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-07-07 (6 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
queue-scheduler 1.0MIT/X Consortium ...5PHP 5, Libraries, Design Patterns, Pe...
Description 

Author

This package can queue jobs to be executed by worker tasks.

It uses the Laravel Illuminate queue class to add jobs to a queue to be executed with given parameter details.

The queue can management is done by any driver class supported by the queue class, like, beanstalkd.

A monitor class can be passed to get events of the job processing steps.

The worker script can pull queued jobs and execute the pending jobs until the queue is empty.

Picture of Chun-Sheng, Li
  Performance   Level  
Name: Chun-Sheng, Li <contact>
Classes: 34 packages by
Country: Taiwan Taiwan
Innovation award
Innovation award
Nominee: 16x

Winner: 1x

Example

<?php

require_once __DIR__.'/../../vendor/autoload.php';
require_once
__DIR__.'/../Loader.php';

use
Illuminate\Queue\Capsule\Manager as Queue;
use
peter\Scheduler\Loader;
use
peter\Scheduler\WeatherJob;
use
peter\Scheduler\MonitorJob;

// Make this Capsule instance available globally via static methods... (optional)
$queue = Loader::loadDriver();
$queue->setAsGlobal();
//Queue::push(WeatherJob::class, ['email' => 'masnun@gmail.com']);
Queue::push(MonitorJob::class, ['email' => 'masnun@gmail.com',
   
'urls' => [
       
'peter279k.com.tw',
       
'www.goo.com',
       
'12345678',
    ]
]);


Details

Introduction

The `job.php` is the sample code for calling two jobs.

The `WeatherJob` and `MonitorJob`.There are all in the `src` folder.

Create the jobs

If you want to create your own job, you can create the `YourJob` class in `YourJob.php` file and put it in the `src` folder.

And Remember to add the `require_once __DIR__.'/WeatherJob.php';` in `worker.php`.

You have to notice that the namespace so you need to set the right namespace in `YourJob.php` and `job.php`.


  Files folder image Files  
File Role Description
Files folder imagesrc (5 files, 1 directory)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageExamples (2 files)
  Plain text file Loader.php Class Class source
  Plain text file MonitorJob.php Class Class source
  Plain text file SendMail.php Class Class source
  Plain text file WeatherJob.php Class Class source
  Accessible without login Plain text file worker.php Example Example script

  Files folder image Files  /  src  /  Examples  
File Role Description
  Accessible without login Plain text file job.php Example Example script
  Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads  
 100%
Total:0
This week:0