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 581846ba9b Update debian install instructions, jessie-backports 9 years ago
..
bin php script minor fix 10 years ago
ext/grpc php: missed a line in doc 9 years ago
lib/Grpc php: $metadata at API should be optional 9 years ago
tests php: add cancel_after_begin interop test 9 years ago
.gitignore ignore PHP vendor/ folder 10 years ago
README.md Update debian install instructions, jessie-backports 9 years ago
composer.json php: bump version 9 years ago

README.md

#Overview

This directory contains source code for PHP implementation of gRPC layered on shared C library.

#Status

Alpha : Ready for early adopters

Environment

Prerequisite: PHP 5.5 or later, phpunit, pecl

Linux:

$ sudo apt-get install php5 php5-dev phpunit php-pear

Mac OS X:

$ curl https://phar.phpunit.de/phpunit.phar -o phpunit.phar
$ chmod +x phpunit.phar
$ sudo mv phpunit.phar /usr/local/bin/phpunit

$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar

Quick Install

Linux (Debian):

Add Debian jessie-backports to your sources.list file. Example:

echo "deb http://http.debian.net/debian jessie-backports main" | \
sudo tee -a /etc/apt/sources.list

Install the gRPC Debian package

sudo apt-get update
sudo apt-get install libgrpc-dev

Install the gRPC PHP extension

sudo pecl install grpc-alpha

Mac OS X:

Install homebrew. Example:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install the gRPC core library and the PHP extension in one step

$ curl -fsSL https://goo.gl/getgrpc | bash -s php

This will download and run the gRPC install script and compile the gRPC PHP extension.

Build from Source

Clone this repository

$ git clone https://github.com/grpc/grpc.git

Build and install the gRPC C core libraries

$ cd grpc
$ git pull --recurse-submodules && git submodule update --init --recursive
$ make
$ sudo make install

Note: you may encounter a warning about the Protobuf compiler protoc 3.0.0+ not being installed. The following might help, and will be useful later on when we need to compile the protoc-gen-php tool.

$ cd grpc/third_party/protobuf
$ sudo make install   # 'make' should have been run by core grpc

Install the gRPC PHP extension

$ sudo pecl install grpc-alpha

OR

$ cd grpc/src/php/ext/grpc
$ phpize
$ ./configure
$ make
$ sudo make install

In your php.ini file, add the line extension=grpc.so to load the extension at PHP startup.

Install Composer

$ cd grpc/src/php
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install

Unit Tests

Run unit tests

$ cd grpc/src/php
$ ./bin/run_tests.sh

Generated Code Tests

Install protoc-gen-php

$ cd grpc/src/php/vendor/datto/protobuf-php
$ gem install rake ronn
$ rake pear:package version=1.0
$ sudo pear install Protobuf-1.0.tgz

Generate client stub code

$ cd grpc/src/php
$ ./bin/generate_proto_php.sh

Run a local server serving the math services

  • Please see Node on how to run an example server
$ cd grpc/src/node
$ npm install
$ nodejs examples/math_server.js

Run the generated code tests

$ cd grpc/src/php
$ ./bin/run_gen_code_test.sh