chllen/hyperf-grpc-client

There is no license information available for the latest version (v1.0.0-alpha) of this package.

A grpc client component for Hyperf.

Maintainers

👁 chllen

Package info

github.com/chllen/hyperf-grpc-client

pkg:composer/chllen/hyperf-grpc-client

Statistics

Installs: 1

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0-alpha 2023-02-18 14:33 UTC

Requires

Requires (Dev)

None

Suggests

Provides

None

Conflicts

None

Replaces

None

Unknown License f4de21b11137cdb5b972f870685462220cbb9d31

phpswoolehyperfgrpc-client

This package is auto-updated.

Last update: 2026-06-20 13:23:58 UTC


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']
 );
 }
}