### 朋友需要在windows下进行php+grpc的相关开发,然后发现官方的grpc未提供windows下的php plugin的exe文件,故建立此项目,希望能够帮助更多的以windows为开发环境的开发者。
# 这是一个grpc+protobuf的windows版本
项目使用 [vcpkg](https://github.com/microsoft/vcpkg)编译,仅供大家测试使用,请勿用于正式环境
### 安装命令
- clone [vcpkg](https://github.com/microsoft/vcpkg) 项目到本地
- 安装最新的vcpkg。
bootstrap-vcpkg.bat
- 安装grpc
vcpkg install grpc
- x86文件位置
installed\x86-windows\tools\protobuf
installed\x86-windows\tools\grpc
- x64文件位置
installed\x64-windows\tools\protobuf
installed\x64-windows\tools\grpc
### 说明
- vcpkg install grpc 会自动安装x64和x86版本的grpc
- 本地安装发现x86版本的tools/grpc目录下的libprotobuf.dll和libprotoc.dll和tools/protobuf下的libprotobuf.dll和libprotoc.dll 大小不一致
- 建议x86和x64的分开安装,
- 安装x86版本vcpkg install grpc:x86-windows grpc[codegen]:x86-windows --host-triplet=x86-windows
- 安装x64版本vcpkg install grpc:x64-windows grpc[codegen]:x64-windows --host-triplet=x64-windows
- 如果没有生成grpc的plugin是因为没有安装grpc[codegen],可以按需安装,本地安装发现x64会自动安装grpc plugin,x86需要指定安装grpc['codegen']:x86-windows
# 版本日志
- 2020.1.14 grpc 1.26,protoc 3.11.2
- 2020.6.12 grpc 1.28.1 protoc 3.12.0
- 2022.11.30 grpc 1.50.1 protoc 3.21.8
- 2023.02.09 grpc 1.51.1 protoc 3.21.12
# 使用方法
### 生成php文件的参考命令
`protoc.exe --proto_path=. --php_out=. --grpc_out=. --plugin=protoc-gen-grpc=grpc_php_plugin.exe helloworld.proto`
参考[protocbuf使用](https://developers.google.com/protocol-buffers/docs/proto3#generating)
可以把exe的目录添加到系统的path变量下
# 特别说明
- 使用vcpkg 2022-11-10-5fdee72bc1fceca198fb1ab7589837206a8b81ba这个版本安装grpc会出现安装x86的grpc,安装完成后出现类似
```
grpc provides CMake targets:
# this is heuristically generated, and may not be correct
find_package(gRPC CONFIG REQUIRED)
# note: 7 additional targets are not displayed.
target_link_libraries(main PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc++_alts)
find_package(modules CONFIG REQUIRED)
target_link_libraries(main PRIVATE re2::re2 c-ares::cares)
```
这样的错误可以忽略
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
gRPC Java、Go、PHP使用例子 (202个子文件)
libprotobuf.dll 2.41MB
libprotobuf.dll 2.17MB
libprotoc.dll 1.95MB
libprotoc.dll 1.77MB
grpc_cpp_plugin.exe 178KB
grpc_cpp_plugin.exe 158KB
grpc_python_plugin.exe 119KB
grpc_python_plugin.exe 112KB
grpc_csharp_plugin.exe 93KB
grpc_objective_c_plugin.exe 85KB
grpc_csharp_plugin.exe 79KB
grpc_objective_c_plugin.exe 75KB
grpc_php_plugin.exe 73KB
grpc_node_plugin.exe 67KB
grpc_ruby_plugin.exe 62KB
grpc_php_plugin.exe 59KB
grpc_node_plugin.exe 56KB
grpc_ruby_plugin.exe 52KB
protoc.exe 22KB
protoc.exe 19KB
helloworld.pb.go 8KB
helloworld_grpc.pb.go 5KB
client.go 1KB
HelloServer.java 2KB
HelloClient.java 1KB
Main.java 233B
installed.json 4KB
composer.json 557B
composer.json 555B
composer.json 230B
LICENSE 11KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
composer.lock 4KB
README.md 2KB
MAINTAINERS.md 770B
README.md 377B
README.md 357B
go.mod 371B
roots.pem 258KB
Message.php 73KB
FileOptions.php 39KB
FieldOptions.php 24KB
GPBUtil.php 22KB
FieldDescriptorProto.php 21KB
BaseStub.php 21KB
Descriptor.php 20KB
MessageOptions.php 19KB
Location.php 18KB
FileDescriptorProto.php 16KB
GPBWire.php 16KB
ClassLoader.php 16KB
InstalledVersions.php 16KB
Api.php 13KB
SourceCodeInfo.php 12KB
DescriptorProto.php 11KB
Any.php 11KB
CodedInputStream.php 10KB
Field.php 10KB
GPBJsonWire.php 9KB
EnumOptions.php 9KB
UninterpretedOption.php 8KB
Annotation.php 7KB
FieldDescriptor.php 7KB
MethodDescriptorProto.php 7KB
FieldMask.php 7KB
MapField.php 7KB
Timestamp.php 7KB
Method.php 7KB
RepeatedField.php 7KB
EnumDescriptorProto.php 7KB
Type.php 7KB
Duration.php 7KB
Value.php 6KB
Enum.php 5KB
MethodOptions.php 5KB
DescriptorPool.php 5KB
Mixin.php 5KB
Descriptor.php 5KB
RpcServer.php 5KB
Kind.php 5KB
Type.php 5KB
Option.php 4KB
EnumValueOptions.php 4KB
ServiceOptions.php 4KB
AbstractCall.php 4KB
CodedOutputStream.php 4KB
ExtensionRange.php 4KB
ServiceDescriptorProto.php 4KB
EnumValueDescriptorProto.php 3KB
EnumValue.php 3KB
AnyBase.php 3KB
EnumReservedRange.php 3KB
NamePart.php 3KB
ServerStreamingCall.php 3KB
MapFieldIter.php 3KB
ServerCallWriter.php 3KB
BidiStreamingCall.php 3KB
FieldDescriptor.php 3KB
共 202 条
- 1
- 2
- 3
资源评论
penngo
- 粉丝: 1w+
- 资源: 66
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功