Download the PHP package yoanm/symfony-jsonrpc-http-server without Composer
On this page you can find all versions of the php package yoanm/symfony-jsonrpc-http-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yoanm/symfony-jsonrpc-http-server
More information about yoanm/symfony-jsonrpc-http-server
Files in yoanm/symfony-jsonrpc-http-server
Package symfony-jsonrpc-http-server
Short Description Symfony Bundle to convert an HTTP json-rpc request into HTTP json-rpc response
License MIT
Informations about the package symfony-jsonrpc-http-server
Symfony JSON-RPC server
Symfony JSON-RPC HTTP Server to convert an HTTP json-rpc request into HTTP json-rpc response.
Symfony bundle for yoanm/jsonrpc-server-sdk
See yoanm/symfony-jsonrpc-params-validator for params validation.
See yoanm/symfony-jsonrpc-http-server-doc for documentation generation.
Versions
-
Symfony v3/4 - PHP >=7.1 :
^2.0
⚠️⚠️
v2.1.0
andv2.1.1
were badly taggued, usedv3.0.0
instead ! ⚠️⚠️ -
Symfony v4/5 - PHP >=7.2 :
~3.0.0
-
Symfony v4/5 - PHP >=7.3 :
^3.1
-
Symfony v4.4/5.4 - PHP ^8.0 :
^3.2
- Symfony v4.4/5.4/6.x - PHP ^8.0 :
^3.3
How to use
Once configured, your project is ready to handle HTTP POST
request on /json-rpc
endpoint.
See below how to configure it.
Configuration
Bundle requires only one thing :
- JSON-RPC Methods which are compatible with
yoanm/jsonrpc-server-sdk
It comes with service locator. Using a service locator allow to load (and so instanciate dependencies, dependencies of dependencies, etc) method only when required (usually only one method is required by request, except for batch requests which will load one or more methods).
Behat demo app configuration folders can be used as examples.
-
Add the bundles in your
config/bundles.php
file: -
Add the following in your routing configuration :
- Add the following in your configuration :
JSON-RPC Method mapping
In order to inject yours JSON-RPC method into the server add the tag json_rpc_http_server.jsonrpc_method
and the key/value method
like following example :
Methods mapping aware
In case you want to be aware of which methods are registered inside the JSON-RPC server, you can use the json_rpc_http_server.method_aware
. Your class must implements JsonRpcMethodAwareInterface
.
Debug mode
You can setup 'debug' mode for the JSON-RPC server, which allows display of verbose error information within the response JSON body. This information contains actual exception class name, code, message and stack trace.
Note: you should never enable 'debug' mode in 'production' environment, since it will expose vital internal information to the API consumer.
Configuration example:
Contributing
See contributing note
All versions of symfony-jsonrpc-http-server with dependencies
psr/container Version ^1.0
symfony/config Version ^4.4 || ^5.4 || ^6.0
symfony/dependency-injection Version ^4.4 || ^5.4 || ^6.0
symfony/event-dispatcher Version ^4.4 || ^5.4 || ^6.0
symfony/event-dispatcher-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/http-foundation Version ^4.4 || ^5.4 || ^6.0
symfony/http-kernel Version ^4.4 || ^5.4 || ^6.0
yoanm/jsonrpc-server-sdk Version ^3.3