aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/php
diff options
context:
space:
mode:
Diffstat (limited to 'examples/php')
-rw-r--r--examples/php/README.md10
-rw-r--r--examples/php/composer.json11
-rw-r--r--examples/php/greeter_client.php6
-rw-r--r--examples/php/route_guide/route_guide_client.php6
4 files changed, 16 insertions, 17 deletions
diff --git a/examples/php/README.md b/examples/php/README.md
index 8fb060863a..ea9ccb6790 100644
--- a/examples/php/README.md
+++ b/examples/php/README.md
@@ -4,16 +4,15 @@ gRPC in 3 minutes (PHP)
PREREQUISITES
-------------
-This requires PHP 5.5 or greater.
+This requires `php` >=5.5, `phpize`, `pecl`, `phpunit`
INSTALL
-------
- - On Mac OS X, install [homebrew][]. Run the following command to install gRPC.
+ - Install the gRPC PHP extension
```sh
- $ curl -fsSL https://goo.gl/getgrpc | bash -s php
+ $ [sudo] pecl install grpc-beta
```
- This will download and run the [gRPC install script][] and compile the gRPC PHP extension.
- Clone this repository
@@ -37,6 +36,7 @@ TRY IT!
Please follow the instruction in [Node][] to run the server
```
$ cd examples/node
+ $ npm install
$ nodejs greeter_server.js
```
@@ -58,7 +58,5 @@ TUTORIAL
You can find a more detailed tutorial in [gRPC Basics: PHP][]
-[homebrew]:http://brew.sh
-[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install
[Node]:https://github.com/grpc/grpc/tree/master/examples/node
[gRPC Basics: PHP]:http://www.grpc.io/docs/tutorials/basic/php.html
diff --git a/examples/php/composer.json b/examples/php/composer.json
index 9f44f0b186..c837bf7ac0 100644
--- a/examples/php/composer.json
+++ b/examples/php/composer.json
@@ -1,17 +1,14 @@
{
+ "name": "grpc/grpc-demo",
+ "description": "gRPC example for PHP",
+ "minimum-stability": "dev",
"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",
- "google/auth": "dev-master",
- "grpc/grpc": "dev-release-0_11"
+ "grpc/grpc": "dev-release-0_13"
}
}
diff --git a/examples/php/greeter_client.php b/examples/php/greeter_client.php
index e5e4c2651e..3fab14f33e 100644
--- a/examples/php/greeter_client.php
+++ b/examples/php/greeter_client.php
@@ -1,7 +1,7 @@
<?php
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,9 @@ require dirname(__FILE__) . '/vendor/autoload.php';
require dirname(__FILE__) . '/helloworld.php';
function greet($name) {
- $client = new helloworld\GreeterClient('localhost:50051', []);
+ $client = new helloworld\GreeterClient('localhost:50051', [
+ 'credentials' => Grpc\ChannelCredentials::createInsecure()
+ ]);
$request = new helloworld\HelloRequest();
$request->setName($name);
list($reply, $status) = $client->SayHello($request)->wait();
diff --git a/examples/php/route_guide/route_guide_client.php b/examples/php/route_guide/route_guide_client.php
index 3cd1df7254..cc8640cf70 100644
--- a/examples/php/route_guide/route_guide_client.php
+++ b/examples/php/route_guide/route_guide_client.php
@@ -1,7 +1,7 @@
<?php
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,9 @@ require dirname(__FILE__) . '/route_guide.php';
define('COORD_FACTOR', 1e7);
-$client = new routeguide\RouteGuideClient('localhost:50051', []);
+$client = new routeguide\RouteGuideClient('localhost:50051', [
+ 'credentials' => Grpc\ChannelCredentials::createInsecure()
+]);
function printFeature($feature) {
$name = $feature->getName();