jaczkog / json-rpc
JSON-RPC client
Installs: 53
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jaczkog/json-rpc
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); }