2017 © Pedro Peláez
 

library jsonrpc-server

Jsonrpc server php implementation

image

moaction/jsonrpc-server

Jsonrpc server php implementation

  • Friday, December 20, 2013
  • by nitso
  • Repository
  • 1 Watchers
  • 0 Stars
  • 59 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

jsonrpc-server

Server implementation for JsonRPC 2.0 protocol, (*1)

http://www.jsonrpc.org/specification, (*2)

Usage

Basic usage

$server = new \Moaction\Jsonrpc\Server\BasicServer();
$server->addMethod('getUser', function($id) {
  return array(
    'id'   => $id,
    'name' => 'UserName'
  );
});

echo $server->run(file_get_contents('php://input'));

Error reporting

Every exception in method call will be converted into error object in response. You can specify code and message in exception., (*3)

$server->addMethod('errorTest', function() {
  throw new \Exception('Strange server error', 42);
});

Server response will be:, (*4)

{"jsonrpc": "2.0", "error": {"code": 42, "message": "Strange server error"}, "id": null}

If you do not provide code, default "Server Error" code -32000 will be used. As well as error message., (*5)

The Versions

20/12 2013

dev-master

9999999-dev

Jsonrpc server php implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Kalinin

20/12 2013

v1.1

1.1.0.0

Jsonrpc server php implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Kalinin

18/12 2013

v1.0

1.0.0.0

Jsonrpc server php implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Kalinin