The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Stanley Cheung 18af795edf Update min PHP testing version from PHP 7.4 to 8.1 (#35964) 9 months ago
..
README.md PHP: update examples (#28159) 3 years ago
apache.Dockerfile Update min PHP testing version from PHP 7.4 to 8.1 (#35964) 9 months ago
base.Dockerfile Update min PHP testing version from PHP 7.4 to 8.1 (#35964) 9 months ago
cli.Dockerfile Update min PHP testing version from PHP 7.4 to 8.1 (#35964) 9 months ago
client.php PHP: add various scenarios to test PECL extension 5 years ago
composer.json PHP: php server commit 4/n, add RpcServer, generator and server examples (#25640) 4 years ago
echo.proto PHP: add various scenarios to test PECL extension 5 years ago
fpm.Dockerfile Update min PHP testing version from PHP 7.4 to 8.1 (#35964) 9 months ago
nginx.conf PHP: add various scenarios to test PECL extension 5 years ago

README.md

gRPC PHP End-to-End Examples

This page shows a number of ways to create a PHP gRPC client and connect with a gRPC backend service.

Run the Server

For all the following examples, we use a simple gRPC server, written in Node.

$ git clone https://github.com/grpc/grpc-web
$ cd grpc-web
$ docker-compose build prereqs node-server
$ docker run -d -p 9090:9090 --name node-server grpcweb/node-server

Install the gRPC PECL extension

All the following commands are assumed to be run from this current directory.

$ cd grpc/examples/php/echo

In order to build a PHP gRPC client, we need to install the grpc extension first.

$ docker build -t grpc-php/base -f ./base.Dockerfile .

CLI

Let's first build a simple CLI gRPC client:

$ docker build -t grpc-php/echo-client -f ./cli.Dockerfile .
$ docker run -it --rm --link node-server:node-server grpc-php/echo-client
$ php client.php

Apache

Now let's see how the gRPC PHP client can run with Apache:

$ docker build -t grpc-php/apache -f ./apache.Dockerfile .
$ docker run -it --rm --link node-server:node-server -p 80:80 grpc-php/apache

Open the browser to http://localhost.

Nginx + FPM

We can also try running PHP-FPM and put Nginx in front of it.

The PHP-FPM part:

$ docker build -t grpc-php/fpm -f ./fpm.Dockerfile .
$ docker run -it --rm --link node-server:node-server -p 9000:9000 \
  --name fpm grpc-php/fpm

The Nginx part:

$ docker run -it --rm -v $(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf:ro \
  --link fpm:fpm -p 80:80 nginx:1.17.4

Open the browser to http://localhost.