neznajki / json-rpc-server
server for json rpc
v0.2.1
2020-07-24 10:36 UTC
Requires
- php: >=7.3
- ext-json: *
- neznajki/json-rpc-common: ^1.0
Requires (Dev)
- symfony/dependency-injection: ^4.4
- symfony/event-dispatcher: ^4.4
- symfony/flex: ^1.4
- symfony/framework-bundle: ^4.4
README
makes authorization for json rpc
installation
- composer require neznajki/json-rpc-server
- services.yaml
imports: - { resource: '@JsonRpcServerBundle/Resources/config/services.yaml' }
- routes.yaml
jsonRpc: resource: '@JsonRpcServerBundle/Resources/config/routing.yaml'
method creation
App\Api\CoolMethod: tags: [ 'json.rpc.server.method' ]
class CoolMethod implements MethodHandlerInterface { /** * @param string $test * @param int|null $test2 * @return mixed */ public function handle(string $test = null, ?int $test2 = null) { return $test . 'tt'; } /** * @return string */ public function getMethod(): string { return 'coolMethodIncomingName'; } /** * @return array */ public function getRequiredParameters(): array { return ['test']; } }