Download the PHP package bankiru/rpc-server-bundle without Composer
On this page you can find all versions of the php package bankiru/rpc-server-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package rpc-server-bundle
HTTP RPC Server bundle
This bundle provides default controller realisation to handle RPC requests which come to the application via HTTP requests
Implementations
RPC server does not declares any implementation requirements. Some could be
- JSON-RPC
- SOAP (extends XML-RPC)
or other custom RPC which operates with method+parameters and utilizes single endpoint for several methods
HTTP Endpoints
Endpoint is a HTTP route which process basic HTTP request, providing initial parsing and processing request data
To enable HTTP endpoint you should enable custom endpoint router loader via the following router configuration:
Resource value is not important, it is ignored when loading routes as the endpoints are configured vua config
Configuration
Basic endpoint configuration looks like
This creates endpoint on URL / with generic symfony controller. Also it
pre-populates the methods from the service_rpc.yml
config file
my-public-endpoint
will become a route name, so make sure it does not
overlap with other routes until you want it do to this.
Method routing
Each RPC request has method and parameters. You can configure the application to handle different methods within different endpoints with different actions
Generic configuration looks like
Different resource types are supported. Built-in are
Annotation
Yaml
Different endpoint implementation may utilize different controller name parsers, so
MyBundle:Test:entity
notation is endpoint-dependent. I.e JSON-RPC may search TestController
controller in MyBundle\JsonRpc\TestController
Resource
You can pass directory, class, file, yaml config as method source with prefix and context inheritance
The following chaing will result in prefix/annotation/sub
method
handled by AnnotationController::subAction
with private
+default
context
Events
This bundle repeats the generic symfony request processing flow. You can hook your extension into given system events
rpc.request
is triggered on handling RPC call- Routing happens here
rpc.controller
is triggered to filter controller (i.e. allows security filtering)rpc.response
is triggered whenever response is acquired by the endpoint processorrpc.view
is triggered if response, returned from controller is not instance ofRpcResponseInterface
rpc.exception
is triggered when exception is raised during RPC call processingrpc.finish_request
is used to finalize RPC response before it is returned to HTTP controller
RPC Controller implementation
The goal of implementing controller is to extend abstract RpcController
passing
RequestInterface
and endpoint name into getResponse
method.
RequestInterface
is an extension of RpcRequestInterface
with extra attributes
allowing request metadata carrying alongside the request.
The generic solution is to convert incoming symfony Request
instance into your own
implementation of RequestInterface
(i.e extract method and args from XML-RPC or JSON-RPC requests)
and send serialized response back, transforming RpcResponseInterface
back to your response object.
You can also automatically convert RpcResponseInterface
into your serialized response via
generic symfony view event processing
All versions of rpc-server-bundle with dependencies
symfony/console Version ~2.7 || ~3.0
symfony/config Version ~2.7 || ~3.0
symfony/http-kernel Version ~2.7 || ~3.0
symfony/yaml Version ~2.7 || ~3.0
symfony/dependency-injection Version ~2.7 || ~3.0
doctrine/annotations Version ~1.2
scaytrase/rpc-common Version ~1.0