Skip to content

Instantly share code, notes, and snippets.

@ksimka
Last active August 29, 2015 14:06
Show Gist options
  • Save ksimka/9a11014eaf17193493ed to your computer and use it in GitHub Desktop.
Save ksimka/9a11014eaf17193493ed to your computer and use it in GitHub Desktop.

List of JSON RPC client libraries in PHP available on GitHub.

https://github.com/fguillot/JsonRPC

  • no transport injection (curl)
  • no json options (json_encode, json_decode)
  • no read timeout (no interface)
  • returns raw result from result key and null on error
  • id = mt_rand() (no way to set custom)

https://github.com/EvilScott/junior

  • no transport injection (file_get_contents)
  • no json options (json_encode, json_decode)
  • no any timeout options
  • response object with public props
  • utf8_decode (wtf)
  • id = uniqid() (no way to set custom)

https://github.com/soundasleep/jsonrpcclient/

  • no transport injection (fopen)
  • no json options (json_encode, json_decode)
  • no any timeout options
  • returns raw result from result key and throws exception on error
  • id = ++ (no way to set custom)

https://github.com/marcelklehr/tivoka/

  • no transport injection (file_get_contents for http, fsockopen for tcp and websocket)
  • no json options (json_encode, json_decode)
  • no read timeout
  • public props
  • id = uuid (no way to set custom)

https://github.com/sergeyfast/

  • no transport injection (curl)
  • no json options (json_encode, json_decode)
  • no read timeout (no interface)
  • id = ++ (no way to set custom)
  • bad design at all

https://github.com/subutux/json-rpc2php

  • too simple, no options, common problems as for others

https://github.com/johnstevenson/jsonrpc/

  • transport injection! but no interface for it
  • no json options (json_encode, json_decode)
  • client contains response, doesn't return it
  • id = ++ (no way to set custom)

https://github.com/Pozo/json-rpc-php/

  • no transport injection (curl)
  • no json options (json_encode, json_decode)
  • no any timeout
  • returns raw result as stdObject
  • native interface (without alternative)
  • id = ++ (no way to set custom)

What's the perfect JSON RPC client library

  • separate implementation for JSON RPC objects and communication
  • transport injection (interface) with out-of-the-box implementation for popular clients like Guzzle
  • json options for json_encode, json_decode
  • timeouts: connect, write, read
  • uses objects for request and response, no public props — public getters
  • request with custom id (id should be controlled by a request manager, not request itself)
  • promises as results on batch request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment