baohan / swoole-job
A multi-processes worker framework based on Swoole
1.0.2
2016-08-29 07:32 UTC
Requires
- php: ^5.5.9
- baohan/collection: 1.0.*
- respect/validation: 1.1.*
README
A job dispatcher based on swoole
Install
Install swoole
first.
composer update baohan/swoole-job
How
Quick start
$router = new \baohan\SwooleJob\Router(); $router->setPrefix("\\App\\Job\\"); $router->setExecutor("execute"); $router->setDecode(function($data) { return json_decode($data, true); }); $serv = new \baohan\SwooleJob\Server($router); $serv->setSwoolePort(9505); // custom callback event $serv->setEvtStart(function($serv) { echo "server start!" . PHP_EOL; }); $serv->start();
Configure
Event callbacks