{"id":37006138,"url":"https://github.com/crayxn/hyperf-grpc","last_synced_at":"2026-01-14T00:43:17.543Z","repository":{"id":65574321,"uuid":"590701816","full_name":"crayxn/hyperf-grpc","owner":"crayxn","description":"Hyperf Grpc 服务插件，协助完成grpc服务（支持全部模式）、服务注册、服务链路追踪、服务健康、服务反射等","archived":false,"fork":false,"pushed_at":"2023-07-14T02:53:43.000Z","size":83,"stargazers_count":25,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T16:34:20.822Z","etag":null,"topics":["consul","grpc","grpc-client","grpc-health","grpc-reflection","grpc-registry","grpc-server","hyperf","jeager","nacos","php","streaming","trace"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crayxn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-19T01:50:40.000Z","updated_at":"2025-01-14T05:50:48.000Z","dependencies_parsed_at":"2023-02-16T04:46:10.806Z","dependency_job_id":null,"html_url":"https://github.com/crayxn/hyperf-grpc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/crayxn/hyperf-grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crayxn%2Fhyperf-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crayxn%2Fhyperf-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crayxn%2Fhyperf-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crayxn%2Fhyperf-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crayxn","download_url":"https://codeload.github.com/crayxn/hyperf-grpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crayxn%2Fhyperf-grpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consul","grpc","grpc-client","grpc-health","grpc-reflection","grpc-registry","grpc-server","hyperf","jeager","nacos","php","streaming","trace"],"created_at":"2026-01-14T00:43:16.914Z","updated_at":"2026-01-14T00:43:17.529Z","avatar_url":"https://github.com/crayxn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crayoon/hyperf-grpc\n\nHyperf Grpc 服务插件，协助完成grpc服务注册、服务链路追踪、服务健康、服务反射等\n\n使用教程 https://learnku.com/articles/75681 如果有帮助到您的话，还请给个星哦\n\n*请先阅读hyperf文档grpc服务一节 https://hyperf.wiki/3.0/#/zh-cn/grpc*\n\n## Update\n### [2.x]\n- 服务处理重写，支持GRPC全模式（一元模式、客户端流模式、服务端流模式、双向流模式）\n\n### [1.x] \n- 重构服务反射，提升速度\n- TracerDriver 默认配置调整为Noop类型\n- 服务注册优化异常时跳过\n- 增加支持 Grpc Streaming\n- 增积支持 GrpcHealth Watch Streaming模式\n\n## 快速开始\n\n### 引入\n\n```\ncomposer require crayoon/hyperf-grpc dev-2.0-alpha\n```\n\n### 生成配置文件\n\n```\nphp bin/hyperf.php vendor:publish crayoon/hyperf-grpc\n```\n\n### 配置\n修改 config/autoload/annotations.php\n```php\nreturn [\n    'scan' =\u003e [\n        'paths' =\u003e [\n            BASE_PATH . '/app',\n        ],\n        'ignore_annotations' =\u003e [\n            'mixin',\n        ],\n        'class_map' =\u003e [\n            \\Google\\Protobuf\\Internal\\DescriptorPool::class =\u003e BASE_PATH.'/vendor/crayoon/hyperf-grpc/class_map/Protobuf/DescriptorPool.php'\n        ]\n    ]\n];\n```\n修改 config/autoload/server.php\n```php\n    'servers' =\u003e [\n        [\n            'name' =\u003e 'grpc',\n            'type' =\u003e Server::SERVER_BASE,\n            'host' =\u003e '0.0.0.0',\n            'port' =\u003e 9501,\n            'sock_type' =\u003e SWOOLE_SOCK_TCP,\n            'callbacks' =\u003e [\n                Event::ON_RECEIVE =\u003e [\\Crayoon\\HyperfGrpc\\Server\\StreamServer::class, 'onReceive']\n            ],\n        ],\n        ...\n    ],\n```\n\n### 流模式使用\n\n```php\n// config/routes.php\n// 路由使用助手类注册\nGrpcHelper::RegisterRoutes(function () {\n    // 在此处添加路由\n    Router::addGroup('/goods.v1.Goods', function () {\n        Router::post('/info', [\\App\\Controller\\Grpc\\GoodsController::class, \"info\"]);\n        ...\n    });\n    ...\n}, 'grpc', [], true);\n```\n\n可以参考 https://github.com/crayxn/grpc-stream-demo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrayxn%2Fhyperf-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrayxn%2Fhyperf-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrayxn%2Fhyperf-grpc/lists"}