xujif/guzzle-json-rpc
Composer 安装命令:
composer require xujif/guzzle-json-rpc
包简介
json-rpc server and client base on guzzle,support async
README 文档
README
#json-rpc base on guzzle a full json-rpc 2.0 RFC implementation
###Usage ####Server
/* * in any http framworks */ $apiObject = new Api(); $server = new \Xujif\JsonRpc\Server($apiObject); // return array // please return to client with json $ret = $server->handle(); header('Content-Type:application/json') echo json_encode($ret);
####Client
$client = new \Xujif\JsonRpc\Client('API_SERVER_URL'); $client->call('method',[1,2,3]); // or $client->method(1,2,3) // or notification(no result send async) $client->notify()->method(1,2,3) // or batch call $client->batch()->method(1,2,3)->method2(1,2)->exec(); // or batch notification $client->batch()->notify()->method(1,2,3)->method2(1,2)->exec(); // or batch mixed notification and call // if all batch call is notify it will send async $client->batch() ->notify() ->method(1,2,3) ->notify(false) ->method2(1,2) ->exec();
统计信息
- 总下载量: 418
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-09