GRPC Compiler for Open Swoole PHP GRPC Server

Latest version: pecl install openswoole-4.11.1

Open Swoole GRPC Compiler

Open Swoole GRPC Compiler is a tool to generate stub code and compile GRPC .proto for Open Swoole GRPC Server. You can use the openswoole/protoc docker images to compile and generate PHP codes or install the GRPC protoc plugin at your local environment.

Install openswoole-grpc code generator plugin

Download package from releases page.

cp ./protoc-gen-openswoole-grpc /usr/local/bin/

Generate PHP stub codes from GRPC proto files

protoc --php_out=./src \
       --openswoole-grpc_out=./src helloworld.proto
# or
protoc --php_out=./src \
       --openswoole-grpc_out=./src \
       --plugin=protoc-gen-grpc=protoc-gen-openswoole-grpc \
       helloworld.proto

Use openswoole/protoc Docker image to generate codes

docker run -v $APP_DIR:/app openswoole/protoc
Last updated on April 1, 2022