2017 © Pedro Peláez
 

library jsonrpc

JSON-RPC 2.0 client/server implementation

image

jsonrpc/jsonrpc

JSON-RPC 2.0 client/server implementation

  • Friday, April 12, 2013
  • by johnstevenson
  • Repository
  • 6 Watchers
  • 32 Stars
  • 110,170 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 17 Forks
  • 7 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

Json-Rpc

Build Status, (*1)

A PHP implementation for JSON-RPC (v2). Contains client and server libraries to handle requests including notification and batch., (*2)

Contents

, (*3)

About

JSON-RPC is a protocol that allows servers to talk to each other using json-encoded structures. It is described in its specification as:, (*4)

A light weight remote procedure call protocol. It is designed to be simple!, (*5)

Full details at jsonrpc.org. You may need to read this to get an overview of the json structures that are used, although the heavy lifting is abstracted away by this implementation. For example, calling a method on a remote server is as simple as:, (*6)

<?php
$client = new JsonRpc\Client($url);
$client->call('method', array($param1, $param2));

// now do something with $client->result

And at the server end:, (*7)

<?php
// MethodsClass contains the exposed methods
$methods = new MethodsClass();

$server = new JsonRpc\Server($methods);
$server->receive();

, (*8)

Installation

The easiest way is through composer. Just create a composer.json file and run php composer.phar install to install it:, (*9)

{
    "minimum-stability": "dev",
    "require": {
        "jsonrpc/jsonrpc": "1.0.*"
    }
}

Alternatively, you can download and extract it, or clone this repo. If you just want to try it, see Example., (*10)

, (*11)

Usage

If you downloaded the library through composer then you must add the following somewhere in your bootstrap code:, (*12)

<?php
 require 'vendor/autoload.php';

Otherwise you must point a PSR-0 autoloader to the src directory. Full usage documentation can be found in the Wiki:, (*13)

, (*14)

Example

The quickest way to get the library up and running locally is to point your browser to example/client.php and everything will load automatically. You can then experiment with the code as you read the documentation., (*15)

, (*16)

License

Json-Rpc is licensed under the MIT License - see the LICENSE file for details, (*17)

The Versions

12/04 2013

dev-master

9999999-dev http://github.com/johnstevenson/jsonrpc

JSON-RPC 2.0 client/server implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by John Stevenson

api json json-rpc rpc

30/11 2012

v1.0.3

1.0.3.0 http://github.com/johnstevenson/jsonrpc

JSON-RPC 2.0 client/server implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by John Stevenson

api json json-rpc rpc

26/09 2012

v1.0.2

1.0.2.0 http://github.com/johnstevenson/json-rpc

Client and Server JSON-RPC 2.0 implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by John Stevenson

api json json-rpc xml-rpc rpc

26/09 2012

v1.0.1

1.0.1.0

  Sources   Download

The Requires

  • php >=5.3.0