承接 bednic/json-rpc 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bednic/json-rpc

最新稳定版本:3.4.0

Composer 安装命令:

composer require bednic/json-rpc

包简介

JSON RPC 2.0 implementation

README 文档

README

JSON RPC Docs

JSON-RPC

Usage

  1. Create controller implementing ProcedureController
  2. Pass the controller to dispatcher
  3. Handle json request data with Dispatcher::dispatch(string $data)
  4. 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-17