1. Go to this page and download the library: Download xujif/guzzle-json-rpc 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/ */
xujif / guzzle-json-rpc example snippets
/*
* in any http framworks
*/
$apiObject = new Api();
$server = new \Xujif\JsonRpc\Server($apiObject);
// return array
// please return to client with json
$ret = $server->handle();
header('Content-Type:application/json')
echo json_encode($ret);
$client = new \Xujif\JsonRpc\Client('API_SERVER_URL');
$client->call('method',[1,2,3]);
// or
$client->method(1,2,3)
// or notification(no result send async)
$client->notify()->method(1,2,3)
// or batch call
$client->batch()->method(1,2,3)->method2(1,2)->exec();
// or batch notification
$client->batch()->notify()->method(1,2,3)->method2(1,2)->exec();
// or batch mixed notification and call
// if all batch call is notify it will send async
$client->batch()
->notify()
->method(1,2,3)
->notify(false)
->method2(1,2)
->exec();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.