PHPackages                             crayoon/hyperf-grpc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. crayoon/hyperf-grpc

ActiveLibrary[API Development](/categories/api)

crayoon/hyperf-grpc
===================

hyperf grpc extend

0.1.3(3y ago)253.7k2[1 issues](https://github.com/crayxn/hyperf-grpc/issues)MITPHPPHP &gt;=8.0

Since Jan 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/crayxn/hyperf-grpc)[ Packagist](https://packagist.org/packages/crayoon/hyperf-grpc)[ RSS](/packages/crayoon-hyperf-grpc/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (14)Versions (8)Used By (0)

crayoon/hyperf-grpc
===================

[](#crayoonhyperf-grpc)

Hyperf Grpc 服务插件，协助完成grpc服务注册、服务链路追踪、服务健康、服务反射等

使用教程  如果有帮助到您的话，还请给个星哦

*请先阅读hyperf文档grpc服务一节 *

Update
------

[](#update)

### \[2.x\]

[](#2x)

- 服务处理重写，支持GRPC全模式（一元模式、客户端流模式、服务端流模式、双向流模式）

### \[1.x\]

[](#1x)

- 重构服务反射，提升速度
- TracerDriver 默认配置调整为Noop类型
- 服务注册优化异常时跳过
- 增加支持 Grpc Streaming
- 增积支持 GrpcHealth Watch Streaming模式

快速开始
----

[](#快速开始)

### 引入

[](#引入)

```
composer require crayoon/hyperf-grpc dev-2.0-alpha

```

### 生成配置文件

[](#生成配置文件)

```
php bin/hyperf.php vendor:publish crayoon/hyperf-grpc

```

### 配置

[](#配置)

修改 config/autoload/annotations.php

```
return [
    'scan' => [
        'paths' => [
            BASE_PATH . '/app',
        ],
        'ignore_annotations' => [
            'mixin',
        ],
        'class_map' => [
            \Google\Protobuf\Internal\DescriptorPool::class => BASE_PATH.'/vendor/crayoon/hyperf-grpc/class_map/Protobuf/DescriptorPool.php'
        ]
    ]
];
```

修改 config/autoload/server.php

```
    'servers' => [
        [
            'name' => 'grpc',
            'type' => Server::SERVER_BASE,
            'host' => '0.0.0.0',
            'port' => 9501,
            'sock_type' => SWOOLE_SOCK_TCP,
            'callbacks' => [
                Event::ON_RECEIVE => [\Crayoon\HyperfGrpc\Server\StreamServer::class, 'onReceive']
            ],
        ],
        ...
    ],
```

### 流模式使用

[](#流模式使用)

```
// config/routes.php
// 路由使用助手类注册
GrpcHelper::RegisterRoutes(function () {
    // 在此处添加路由
    Router::addGroup('/goods.v1.Goods', function () {
        Router::post('/info', [\App\Controller\Grpc\GoodsController::class, "info"]);
        ...
    });
    ...
}, 'grpc', [], true);
```

可以参考

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

6

Last Release

1085d ago

Major Versions

0.1.x-dev → 1.0.x-dev2023-05-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c968710990269a99648ae69495ae0850220f6eee547ae36ad1af3da6f799a98?d=identicon)[tangshaoxu](/maintainers/tangshaoxu)

---

Top Contributors

[![crayxn](https://avatars.githubusercontent.com/u/21336335?v=4)](https://github.com/crayxn "crayxn (13 commits)")

---

Tags

consulgrpcgrpc-clientgrpc-healthgrpc-reflectiongrpc-registrygrpc-serverhyperfjeagernacosphpstreamingtracephpgRPChyperf

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/crayoon-hyperf-grpc/health.svg)

```
[![Health](https://phpackages.com/badges/crayoon-hyperf-grpc/health.svg)](https://phpackages.com/packages/crayoon-hyperf-grpc)
```

###  Alternatives

[daodao97/apidog

A swagger library for Hyperf.

15040.1k1](/packages/daodao97-apidog)[kakuilan/hyperf-apihelper

hyperf api swagger helper

443.0k](/packages/kakuilan-hyperf-apihelper)[hyperf/graphql

A GraphQL component for hyperf.

151.0k](/packages/hyperf-graphql)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
