Download the PHP package insidestyles/json-rpc-bundle without Composer
On this page you can find all versions of the php package insidestyles/json-rpc-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download insidestyles/json-rpc-bundle
More information about insidestyles/json-rpc-bundle
Files in insidestyles/json-rpc-bundle
Package json-rpc-bundle
Short Description A simple and fast way to create json rpc server api as microservice. Json Rpc 2.0 Bundle
License MIT
Informations about the package json-rpc-bundle
json-rpc-bundle
Symfony Json Rpc Bundle Fast way to create json rpc microservice, using symfony messenger and laminas json server
- Json Rpc 2.0
- Batch Support
Requirements
"php": ">=8.0",
"ext-json": "*",
"symfony/framework-bundle": "^5.3" || ^6.0,
"laminas/laminas-json-server": "^3.1"
Installation
This package is installable and autoloadable via Composer
Add package config: json_rpc_api.yaml
Add Bundle to App
Add route config: json_rpc_api_routing.yaml
Usage
- Add Example HelloWorldApi
Update api interface with JsonRpcApi Annotation
@JsonRpcApi(namespace = "main")
- HelloWorld Api with Symfony Messenger:
Add requirement:
Config Symfony Messenger https://symfony.com/doc/current/messenger.html
-
Add extra api endpoint with jms serializer and default symfony logger
-
Add custom serializer adapter
-
Add custom serializer adapter
- Enable jms serializer
Tips
-
Install Symfony Validator and validation middle ware from messenger bus for message validation
-
You don't have to extend class AbstractApi if you don't want to use Symfony Messenger. Just implement your own interface that extends JsonRpcApiInterface. See example HelloWorldApi
-
Go to api endpoint http:://localhost/api to see json-rpc methods
-
simple request content
-
batch request content
- using remote service with other api endpoints
Add requirement:
Update service
Now you can call api
All versions of json-rpc-bundle with dependencies
ext-json Version *
symfony/framework-bundle Version ^5.4 || ^6.0
laminas/laminas-json-server Version ^3.3
doctrine/annotations Version ^1.6
laminas/laminas-dependency-plugin Version ^2.1