1. Go to this page and download the library: Download scaytrase/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/ */
scaytrase / json-rpc-client example snippets
use ScayTrase\Api\JsonRpc\JsonRpcClient;
$client = new JsonRpcClient($guzzleClient, 'http://endpoint/url/');
$request = new \ScayTrase\Api\JsonRpc\JsonRpcRequest('my/method', ['param1' => 'val1'], 'request_id');
$notification = new \ScayTrase\Api\JsonRpc\JsonRpcRequest('my/method', ['param1' => 'val1']);
$notification = new \ScayTrase\Api\JsonRpc\JsonRpcNotification('my/method', ['param1' => 'val1']);
final class MyRpcRequest implements \ScayTrase\Api\Rpc\RpcRequestInterface
{
public function getMethod()
{
return 'my/method';
}
public function getParameters()
{
return ['param1' => 'val1'];
}
}
$request = new MyRpcRequest;