neznajki / json-rpc-client-base
Client Base for Json Rpc Requests
v0.1.2
2019-11-06 19:52 UTC
Requires
- php: >=7.3
- ext-curl: *
- ext-json: *
- neznajki/json-rpc-common: ^1.1
Requires (Dev)
- neznajki/codeception-test-engine: ^0.1.1
This package is auto-updated.
Last update: 2024-12-08 19:45:47 UTC
README
client base to make json rpc requests
installation
- composer require neznajki/json-rpc-client-base
- extend
class TestClient extends AbstractClient { /** * @param string $param1 * @param int $param2 * @return ResponseEntity */ public function ping(string $param1, int $param2): ResponseEntity { $request = $this->addPing($param1, $param2); return $this->handle()->getResponseById($request->getId()); } /** * @param string $param1 * @param int $param2 * @return RequestEntity */ protected function addPing(string $param1, int $param2): RequestEntity { return $this->addRequest(__FUNCTION__, ['param1' => $param1, 'param2' => $param2]); } }
- define required items
serivces: TestClient: class: TestClient autowire: true calls: - method: setUser arguments: - '@JsonRpcClientBase\ValueObject\ClientUser' - method: setEndpointUrl arguments: - 'http://myCoolDev.com' JsonRpcClientBase\Contract\RequestHandlerInterface: class: JsonRpcClientBase\RequestHandler\CurlRequestHandler JsonRpcServerCommon\Contract\PasswordEncryptInterface: class: JsonRpcServerCommon\Service\DefaultPasswordEncryptService