ch1p / jobd-client
1.6.1
2023-10-08 01:47 UTC
Requires
- php: >=7.0
- ext-json: *
- ext-sockets: *
README
这是一个简单的PHP客户端,用于jobd。它可以向jobd和jobd-master实例发送请求并读取响应。
安装
composer require ch1p/jobd-client
使用方法
API紧凑简单,只需阅读WorkerClient.php
、MasterClient.php
和Client.php
。
以下是一个小示例。
try { $jobd = new jobd\MasterClient(); } catch (\jobd\exceptions\JobdException $e) { die("Failed to connect.\n"); } try { // poke master to send poll requests to workers $response = $jobd->poke(['target_name', 'another_name']); // get status from master $status = $jobd->status()->getData(); } catch (\jobd\exceptions\JobdException $e) { die('jobd error: '.$e->getMessage()."\n"); } $jobd->close();
许可证
BSD-2c