From f1cc627212cc0f4ad125197f3fc8bfbc279222a7 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 4 Jun 2015 16:16:44 -0700 Subject: [PATCH] remove protobuf-php pear package dependency, use composer instead, script to compile extension from source, update README --- php/README.md | 33 +++++++++++++-------------------- php/composer.json | 7 +++++++ php/greeter_client.php | 2 -- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/php/README.md b/php/README.md index 4c2e6f11d06..f361fc4f009 100644 --- a/php/README.md +++ b/php/README.md @@ -8,6 +8,12 @@ This requires PHP 5.5 or greater. INSTALL ------- + - On Mac OS X, install [homebrew][]. On Linux, install [linuxbrew][]. Run the following command to install gRPC. + + ```sh + $ curl -fsSL https://goo.gl/getgrpc | bash - + ``` + This will download and run the [gRPC install script][]. - Clone this repository @@ -15,15 +21,6 @@ INSTALL $ git clone https://github.com/grpc/grpc-common.git ``` - - Install Protobuf-PHP - - ``` - $ git clone https://github.com/murgatroid99/Protobuf-PHP.git - $ cd Protobuf-PHP - $ rake pear:package version=1.0 - $ pear install Protobuf-1.0.tgz - ``` - - Install composer ``` @@ -40,16 +37,7 @@ INSTALL - (Temporary workaround) Compile gRPC extension from source ``` - $ git clone https://github.com/grpc/grpc.git - $ cd grpc - $ git checkout --track origin/release-0_9 - $ git pull --recurse-submodules && git submodule update --init --recursive - $ cd third_party/protobuf - $ ./autogen.sh && ./configure --prefix=/usr && make && make install - $ cd ../.. - $ make && make install - $ cd src/php/ext/grpc - $ phpize && ./configure && make && make install + $ curl -fsSL https://goo.gl/getgrpc | bash -s php ``` @@ -58,7 +46,7 @@ TRY IT! - Run the server - Please follow the instruction in [Node](https://github.com/grpc/grpc-common/tree/master/node) to run the server + Please follow the instruction in [Node][] to run the server ``` $ cd grpc-common/node $ nodejs greeter_server.js @@ -82,3 +70,8 @@ TUTORIAL -------- Coming soon + +[homebrew]:http://brew.sh +[linuxbrew]:https://github.com/Homebrew/linuxbrew#installation +[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install +[Node]:https://github.com/grpc/grpc-common/tree/master/node diff --git a/php/composer.json b/php/composer.json index 2deca5f0a1b..d1c4bd2a183 100644 --- a/php/composer.json +++ b/php/composer.json @@ -1,9 +1,16 @@ { + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/stanley-cheung/Protobuf-PHP" + } + ], "name": "grpc/grpc-demo", "description": "gRPC example for PHP", "minimum-stability": "dev", "require": { "php": ">=5.5.0", + "datto/protobuf-php": "dev-master", "grpc/grpc": "dev-master" } } diff --git a/php/greeter_client.php b/php/greeter_client.php index 8eeceb38504..663ed7d5d77 100644 --- a/php/greeter_client.php +++ b/php/greeter_client.php @@ -32,8 +32,6 @@ * */ -require 'DrSlump/Protobuf.php'; -\DrSlump\Protobuf::autoload(); require 'vendor/autoload.php'; require 'helloworld.php';