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   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-07-07 (3 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 34 All time: 11,027 This week: 43Up
Version License PHP version Categories
queue-scheduler 1.0.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: 37 packages by
Country: Taiwan Taiwan
Age: 31
All time rank: 21046 in Taiwan Taiwan
Week rank: 4 Up1 in Taiwan Taiwan Up
Innovation award
Innovation award
Nominee: 17x

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 (11)  
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 (11)  /  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 (11)  /  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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:34
This week:0
All time:11,027
This week:43Up