summaryrefslogtreecommitdiff
path: root/README.md
blob: 7f2379ee3a2dc61c0bab4db3f96ba547ba1abd53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# php-jobd-client

This is a simple PHP client for [jobd](https://github.com/gch1p/jobd). It can send
requests and read responses to/from *jobd* and *jobd-master* instances.

## Installation

```
composer require ch1p/jobd-client
```

## Usage

The API is compact and simple, just read the code of `Client.php`.

Here's a small example.

```php
try {
    $jobd = new jobd\Client(jobd\Client::MASTER_PORT, '127.0.0.1');
} catch (Exception $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 (Exception $e) {
    die('jobd error: '.$e->getMessage()."\n");
}

$jobd->close();
```

## License

BSD-2c