2017 © Pedro Peláez
 

yii-extension laravel5queue

image

yiicod/laravel5queue

  • Monday, March 20, 2017
  • by lexxorlov
  • Repository
  • 1 Watchers
  • 2 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Laravel5 Queue

Branch 1.0 for php 5.6 Branch master for php 7.0, (*1)

First of all add laravel5queue component to Yii config (console and main) like this:

'preload' => ['laravel5queue'],
'components' => ['laravel5queue' => ['class' => 'yiicod\laravel5queue\Laravel5Queue']]

and console command like this:, (*2)

'queueWorker' => ['class' => 'yiicod\laravel5queue\commands\WorkerCommand'],

also: component requires "mongodb" component to connect mongo database, (*3)

Adding jobs to queue:

  1. For callable functions:
yiicod\laravel5queue\Laravel5Queue::push(function($job) { <--YOUR CODE HERE--> });

Note: you have to call $job->delete(); in the end of your function to remove it from database, (*4)

  1. For handlers:

Create your own handler which implements yiicod\laravel5queue\base\BaseHandlerInterface OR extends yiicod\laravel5queue\handlers\Handler and run parent::fire($job, $data) to restart db connection before job, (*5)

yiicod\laravel5queue\Laravel5Queue::push(<--YOUR HANDLER CLASS NAME->>, $data);

Note: $data - additional data to your handler, (*6)

Start worker:

run worker daemon with console command like this:, (*7)

$ php yiic queueWorker start

stop worker daemon:, (*8)

$ php yiic queueWorker stop

The Versions

04/03 2016

1.0.x-dev

1.0.9999999.9999999-dev

  Sources   Download

New BSD License

The Requires

 

04/03 2016