baohan / remote
基于 Guzzle 6 的远程客户端
dev-master
2016-10-02 14:28 UTC
Requires
- php: ^5.5.9
- baohan/collection: 1.0.1
- guzzlehttp/guzzle: 6.*
- kevinrob/guzzle-cache-middleware: 1.4.*
This package is auto-updated.
Last update: 2024-08-29 04:46:36 UTC
README
基于 Swoole 和 Gearman 的多进程工作框架
安装
首先安装 swoole
和 gearman
。
如何
快速开始
$worker = new \baohan\SwooleGearman\Queue\Worker(); $worker->addCallback('user::created'); $worker->addCallback('user::updated'); $router = new \baohan\SwooleGearman\Router(); $router->setPrefix("\\App\\Job\\"); $router->setExecutor("execute"); $router->setDecode(function($payload) { return \json_decode($payload, true); }); $worker->addRouter($router); $serv = new \baohan\SwooleGearman\Server($worker); $serv->setSwoolePort(9505); // custom callback event $serv->setEvtStart(function($serv) { echo "server start!" . PHP_EOL; }); $serv->start();
配置
事件回调