View on GitHub


A general JSON RPC client.

Download this project as a .zip file Download this project as a tar.gz file


A general JSON RPC client implementation for PHP.

Project Wiki

GitHub Project Wiki

What's new

Version 0.1.0

We will start working on the JSON RPC 2.0 Codec now.

Getting started


You can use Composer ( to install the JSON RPC library.

    "require": {
        "fritz-payment/jsonrpc": "0.1.*"


This example calls a JSON RPC 1.0 method "test.echo" on the URL using cURL.

use \FritzPayment\JsonRpc\Rpc\Codec\JsonRpc10;
use \FritzPayment\JsonRpc\Client\Transport\Curl;

// initialize JSON RPC 1.0 Codec
$codec = new JsonRpc10();
// initialize cURL transport
$transport = new Curl();

// initialize client
$client = new \FritzPayment\JsonRpc\Client('', $codec, $transport);

// create a new request
/* @var $request \FritzPayment\JsonRpc\Rpc\Codec\JsonRpc10\Request */
$request = $client->newRequest();
$request->setParams(array('test message'));

// send request
$response = $client->exec($request);
if ($response === false) {
    // failed
} else {
    if ($response->isError()) {
        // JSON RPC error
        echo $response->getError()->error();
    } else {

Extending the library

It is possible to create your own implementations of Transports and Codecs.

The abstract Transport and Codec classes and the existing implementations should give you an idea of how to do that.