Skip to content

SzuniSOFT/Docker-PHP-gRPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Docker PHP gRPC

This image has both client and server stub generator plugin. As it is known the server stub generation is not supported officially yet however based on the project Road Runner gRPC PHP we are able to do so.

Build it

After you have pulled the repository you can specify the PHP version directly during the build time.

docker build --build-arg PHP_VERSION=7.2.15 --build-arg PHP_DIST=cli -t php-grpc:7.2.15 .

The available build variables

Name Role Default Values
PHP_VERSION Specifies the interpreter version 7.2.15 any compatible php version
PHP_DIST Specifies PHP distribution cli cli, fpm, zts, apache

Outcome php:${PHP_VERSION}-${PHP_DIST}-stretch

Use it

Generate client stubs

docker run php-grpc:7.2.15 -v <PROJECT_PATH>:<INSIDE_CONTAINER> protoc \
    --php_out=<CLASSES_OUT_PATH> \
    --php-grpc_out=<CLIENT_CLASSES_OUT_PATH> \
    --proto_path=<PATH_TO_LOCATE_PROTO_FILES> \
    --plugin=protoc-gen-php-grpc=/usr/local/bin/grpc_php_client_plugin \
    <NAME_OF_PROTO_FILE>

Generate server stubs

docker run php-grpc:7.2.15 -v <PROJECT_PATH>:<INSIDE_CONTAINER> protoc \
    --php_out=<CLASSES_OUT_PATH> \
    --php-grpc_out=<SERVER_CLASSES_OUT_PATH> \
    --proto_path=<PATH_TO_LOCATE_PROTO_FILES> \
    --plugin=protoc-gen-php-grpc=/usr/local/bin/grpc_php_server_plugin \
    <NAME_OF_PROTO_FILE>

About

Docker PHP gRPC client and server stub generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors