bankiru / jsonrpc-server-bundle
JSON-RPC server symfony bundle
Installs: 16 975
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 4
Open Issues: 4
Type:symfony-bundle
Requires
- php: ~5.5 || ~7.0
- bankiru/rpc-server-bundle: ~1.1
- jms/serializer-bundle: ~1.1
- nelmio/api-doc-bundle: ~2.9
- scaytrase/json-rpc-client: ~1.0
- symfony/http-kernel: ~2.7 || ~3.0
Requires (Dev)
- doctrine/doctrine-bundle: ~1.6
- doctrine/orm: ~2.3
- phpunit/phpunit: ~4.8 || ~5.1
- symfony/browser-kit: ~2.7 || ~3.0
Suggests
- doctrine/doctrine-bundle: For relations handler
- doctrine/orm: For relations handler
This package is not auto-updated.
Last update: 2022-11-08 05:05:38 UTC
README
JSON-RPC Server bundle
This bundle provides JSON-RPC 2.0 server ontop of the bankiru/rpc-server-bundle
library.
Serialization
This bundle uses rpc.view
event in order to serialize response if request
was instance of JsonRpcRequestInterface
and the response is not a
JsonRpcResponseInterface
object. You can bypass the serialization process
with sending pre-created response object or implementing your own view listener
Context
This library utilizes JMS Serializer Bundle
to automatically serialize non-JSON-RPC controller response to serialized view.
You can specify the serialization context at the routing level. Also you
could disable default context usage with with_default_context: false
Exception handling
Any unhandled exception from the controller would be automatically
converted to the proper JSON-RPC failure response with INTERNAL_ERROR (-32603) code.
If you want do display other error you could extend JsonRpcException
class or
configure it manually like following:
$exception = new JsonRpcException(); $execption->setJsonRpcError( new JsonRpcError( JsonRpcError::METHOD_NOT_FOUND, 'Invalid method', (object)['debug_data' => 'some debug data'] ) );
Specification
Refer to official JSON-RPC 2.0 specification at http://www.jsonrpc.org/specification