Skip to content

Latest commit

 

History

History

hello-grpc-php

Hello gRPC php

setup

# https://windows.php.net/download/

$ brew install php composer

$ php -version
# https://getcomposer.org/download/

$ composer --version

grpc module

# PECL(The PHP Extension Community Library)
# PEAR(PHP Extension and Application Repository)
$ pecl install grpc

$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/8.2
Loaded Configuration File:         /usr/local/etc/php/8.2/php.ini
Scan for additional .ini files in: /usr/local/etc/php/8.2/conf.d
Additional .ini files parsed:      /usr/local/etc/php/8.2/conf.d/ext-opcache.ini

$ code /usr/local/etc/php/8.2/php.ini

extension=grpc.so

windows

extension=./php_grpc.dll
extension=./php_protobuf.dll
php --modules | grep grpc

composer

https://getcomposer.org/doc/00-intro.md

composer packagist

composer.json

load dependencies

rm composer.lock
composer install

build

generate code

sh init.sh
php -d extension=grpc.so hello_server.php
php -d extension=grpc.so hello_client.php
php -d extension=php_grpc.dll hello_server.php
php -d extension=php_grpc.dll hello_client.php