PHP code example of iry / async-queue

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

    

iry / async-queue example snippets


namespace MyNamespace;//这您的项目应用的命名空间
//创建一个队列配置(Setting))
class MySetting extends \iry\queue\Setting{
    function storage(); // 返回异步任务存储驱动
    function tempPath(){}
    
    //[可选]
    //function beforeCreate($name, $client);// 任务入队前回调, return false 阻止任务继续入队
    
    //[可选]
    //function afterCreate($id);//任务成功入队后回调
    
    //[可选]
    //function i18n(){} //默认 en-US 系统自带 en-US,zh-CN or file://你的绝对路径
}
 
use iry\queue\Client
Client::m(\MyNamespace\MySetting::class)->create($name,$args,$tags ,$execTime)
 
use iry\queue\Service

new Service()->listen()