PHP code example of zhonghaibin / grpc-service
1. Go to this page and download the library: Download zhonghaibin/grpc-service library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhonghaibin / grpc-service example snippets
sudo docker build -t php-grpc-service:latest .
sudo docker rmi php-grpc-service:latest
这里需要用到下载两个可执行文件编译,我这里用的是win10:
protoc.exe 和 protoc-gen-php-grpc.exe
下载地址:https://github.com/roadrunner-server/roadrunner/releases
命令行执行如下命令:
./protoc.exe --plugin=protoc-gen-php-grpc.exe --php_out=./ --php-grpc_out=./ hello-world.proto
会在当前目录下生成两个文件夹:GPBMetadata 和 Services
把生成好的文件夹复制到 项目目录 grpc/generated 下