jaczkog / json-rpc
JSON-RPC client
1.1.2
2016-09-13 10:23 UTC
Requires
- php: >=5.3
- ext-curl: *
- textalk/websocket: 1.2.*
Requires (Dev)
- phpunit/phpunit: 4.*
README
Setup
composer require jaczkog/json-rpc
Usage
use JsonRpc\JsonRpcClient; $jsonRpcClient = new JsonRpcClient('rpc-server:8080', JsonRpcClient::VERSION_1); $response = $jsonRpcClient->sendRequest('method_name', ['param1' => 1, 'param2' => true]); if ($response->isSuccess()) { echo $response->result; } else { echo sprintf('ERROR: %s (%d)', $response->error->message, $response->error->code); }