jeyroik / extas-http-jsonrpc
There is no license information available for the latest version (0.1.2) of this package.
Extas http jsonrpc package
0.1.2
2020-10-14 11:38 UTC
Requires
- jeyroik/extas-http: 0.*
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-14 20:31:03 UTC
README
Описание
Пакет содержит базовые модели для работы с JSON RPC.
Использование
use extas\interfaces\http\IHasJsonRpcRequest; use extas\components\Item; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use extas\interfaces\http\IHasJsonRpcResponse; use extas\components\http\THasJsonRpcRequest; use extas\components\http\THasJsonRpcResponse; /** * @var RequestInterface $request * @var ResponseInterface $response */ $item = new class ([ IHasJsonRpcRequest::FIELD__PSR_REQUEST => $request, IHasJsonRpcResponse::FIELD__PSR_RESPONSE => $response ]) extends Item { use THasJsonRpcResponse; use THasJsonRpcRequest; protected function getSubjectForExtension() : string{ return 'test'; } }; print_r( $item->successResponse( $item->getJsonRpcRequest()->getId(), [ //some data ] ) );