bednic/json-rpc
最新稳定版本:3.4.0
Composer 安装命令:
composer require bednic/json-rpc
包简介
JSON RPC 2.0 implementation
README 文档
README
JSON RPC Docs
Usage
- Create controller implementing ProcedureController
- Pass the controller to dispatcher
- Handle json request data with
Dispatcher::dispatch(string $data) - Fetch results by calling
Dispatcher::result()
class MyController implements \JSONRPC\ProcedureControllerInterface {
public function subtract(int $a, int $b){
return $a - $b;
}
}
$app->post('/rpc', function($request){
$dispatcher = new \JSONRPC\Dispatcher(new \App\Controller\MyController());
$request->getBody();
$response = $dispatcher->dispatch(json_encode($req));
$result = $response->getResult();
return json_encode($result);
});
Example
See tests in this repo.
统计信息
- 总下载量: 2.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-17