otezvikentiy / json-rpc-api
Symfony Json RPC API bundle
Installs: 152
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.1
- doctrine/annotations: ^2.0
- symfony/console: >=6.3
- symfony/framework-bundle: >=6.3
- symfony/security-bundle: ^7.1
- symfony/serializer: >=6.3
- symfony/validator: >=6.3
- symfony/yaml: >=6.3
Requires (Dev)
- phpunit/phpunit: 11.*
- symfony/property-access: >=6.3
README
The bundle allows you to quickly and conveniently create JSON RPC API applications based on the Symfony framework.
Features
- easy api versioning
- easy bundle installation
- compatible with attributes
- compatible with POST, GET, PUT, PATCH, DELETE requests
- fully compatible with https://www.jsonrpc.org/specification
- swagger openapi out of the box
- callbacks
github: https://github.com/OtezVikentiy/symfony-jsonrpc-api-bundle
Bundle installation
see how to easily install bundle.
Examples
During the installation process, we defined the src/RPC/V1/{*Method.php}
directory in the services and marked with
tags in it all the classes ending in *Method.php
- these will be our API endpoints.
Swagger
If you wish to generate openapi swagger yaml file - then run this command:
bin/console ov:swagger:generate
It would generate a swagger file public/openapi/api_v1.yaml
which you can use in your swagger instance.
see example of how to combine multiple endpoints with tags
see example how to define default, format and example for scalar properties of response
see example how to describe array properties of response
Security
Initially, two implementation options are provided and tested, described below, but you are free to connect any other software solutions to your taste and color.
Auth via lexik jwt token bundle
You may need to add a role model to restrict user access. You always have the option to implement your own version, but there is also a built-in implementation based on the simplest Symfony Security version.