baohan / remote
A remote client based on 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-12-29 05:38:20 UTC
README
A multi-processes worker framework based on Swoole and Gearman
Install
Install swoole
and gearman
first.
How
Quick start
$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();
Configure
Event callbacks