Skip to content

etk-pl/json-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JsonRpc

Build Status Coverage Status Maintainability

Install

$ composer require etk-pl/json-rpc

Example

use JsonRpc\Client;
use JsonRpc\Request;
$client = new Client('http://localhost:8080/');
$response = $client->send(new Request([
	'resource' => 'Test',
	'method' => 'echo',
	'params' => ['param' => 'value']
]));
if($error = $response->getError()) {
	die("Got error: " . $error['message']);
}
$result = $response->getResult();
var_dump($result);

or

use JsonRpc\ApiClient;
$client = new ApiClient('http://localhost:8080/');
try{
	$result = $client->Test->echo(['param' => 'value']);
} catch(\Exception $e) {
	die("Got error: " . $error['message']);
}
var_dump($result);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published