1. Go to this page and download the library: Download jobu/json-rpc-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jobu / json-rpc-client example snippets
Jobu\Client;
use Jobu\Exception\RpcException;
$client = new Client('/path/to/jobud.sock');
$info = $client->info(); // Rejects incompatible API major versions.
if (in_array('queue.list', $info->capabilities, true)) {
$page = $client->call('queue.list', ['limit' => 20]);
foreach ($page->items as $queue) {
echo $queue->name, PHP_EOL;
}
}
try {
$queue = $client->call('queue.create', [
'name' => 'reports',
'idempotency_key' => 'reports-create-1',
]);
} catch (RpcException $e) {
// Safe JobU operation errors expose a category and stable operation code.
echo $e->getMessage(), ' ', $e->operationCode(), PHP_EOL;
}
$client->close();