chllen/hyperf-grpc-client
最新稳定版本:v1.0.0-alpha
Composer 安装命令:
composer require chllen/hyperf-grpc-client
包简介
A grpc client component for Hyperf.
README 文档
README
该组件基于hyperf框架,构建实现服务发现的grpc客户端,我们实现了以etcd为服务中心的组件支持, 目前仅支持对接go-micro。
#配置
添加配置文件 etcd.php
command: php bin/hyperf.php vendor:publish chllen/hyperf-grpc-client
return [ 'uri' => 'http://127.0.0.1:2379', 'version' => 'v3beta', 'retry_interval' => 5, 'path_prefix' => '/micro/registry', 'framework' => 'go-micro', 'options' => [ 'timeout' => 10, ], ];
#使用
封装类Chllen\HyperfGrpcClient\GrpcClient继承于\Hyperf\GrpcClient\BaseClient ,根据 .proto 文件中的定义, 按需扩展:
use Chllen\HyperfGrpcClient\GrpcClient class OrderClient extends GrpcClient { public function create(Order $order) { return $this->_simpleRequest( '/orderService/create', $order, [OrderReply::class, 'decode'] ); } }
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-02-20