Download the PHP package kaidenchen/yii2-resque-enhance without Composer
On this page you can find all versions of the php package kaidenchen/yii2-resque-enhance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kaidenchen/yii2-resque-enhance
More information about kaidenchen/yii2-resque-enhance
Files in kaidenchen/yii2-resque-enhance
Informations about the package yii2-resque-enhance
Yii2 Resque
Resque is a Redis-backed library for creating background jobs, placing those jobs on one or more queues, and processing them later.
Requirement
- php pcntl extension.
- Redis.io
- phpredis extension for better performance, otherwise it'll automatically use Credis as fallback.
- Yii 2
Installation
-
The preferred way to install this extension is through composer.
add
to the require section of your
composer.json
file. -
Create a file
ResqueController.php
in app/commands folder(in case of yii2-basic) or console/controllers(in case of yii2- advance) and write the following code in it. -
Add these in your config/web.php and in your config/console.php(in case of yii2-basic) or console/config/main.php and common/config/main-local.php (in case of yii2- advance)
- Make sure you have already installed
Yii2-redis
Extension
Usage
Once the extension is installed :
-
Create a folder
components
in your app(yii2-basic).in case of yii2-advance template create this folder inside app(like frontend) You can put all your class files into thiscomponents
folder.Change namespace as per your application.Example -
Create job and Workers
You can put this line where ever you want to add jobs to queue
Put your workers inside
components
folder, e.g you want to create worker with name SendEmail then you can create file insidecomponents
folder and name it SendEmail.php, class inside this file must be SendEmailCreate Delayed Job
You can run job at specific time
or run job after n second
Get Current Queues
This will return all job in queue (EXCLUDE all active job)
Start and Stop workers
Run this command from your console/terminal :
Start queue
QUEUE=* php yii resque start
Stop queue
QUEUE=* php yii resque stop