Merge pull request #3168 from stanley-cheung/php_routeguide_package_name

php: change routeguide package name
diff --git a/examples/php/route_guide/README.md b/examples/php/route_guide/README.md
index 258158d..00610ff 100644
--- a/examples/php/route_guide/README.md
+++ b/examples/php/route_guide/README.md
@@ -153,7 +153,7 @@
 
 The file contains:
 - All the protocol buffer code to populate, serialize, and retrieve our request and response message types.
-- A class called `examples\RouteGuideClient` that lets clients call the methods defined in the `RouteGuide` service.
+- A class called `routeguide\RouteGuideClient` that lets clients call the methods defined in the `RouteGuide` service.
 
 
 <a name="client"></a>
@@ -166,7 +166,7 @@
 To call service methods, we first need to create a client object, an instance of the generated `RouteGuideClient` class. The constructor of the class expects the server address and port we want to connect to:
 
 ```php
-$client = new examples\RouteGuideClient(new Grpc\BaseStub('localhost:50051', []));
+$client = new routeguide\RouteGuideClient(new Grpc\BaseStub('localhost:50051', []));
 ```
 
 ### Calling service methods
@@ -178,13 +178,13 @@
 Calling the simple RPC `GetFeature` is nearly as straightforward as calling a local asynchronous method.
 
 ```php
-  $point = new examples\Point();
+  $point = new routeguide\Point();
   $point->setLatitude(409146138);
   $point->setLongitude(-746188906);
   list($feature, $status) = $client->GetFeature($point)->wait();
 ```
 
-As you can see, we create and populate a request object, i.e. an `examples\Point` object. Then, we call the method on the stub, passing it the request object. If there is no error, then we can read the response information from the server from our response object, i.e. an `examples\Feature` object.
+As you can see, we create and populate a request object, i.e. an `routeguide\Point` object. Then, we call the method on the stub, passing it the request object. If there is no error, then we can read the response information from the server from our response object, i.e. an `routeguide\Feature` object.
 
 ```php
   print sprintf("Found %s \n  at %f, %f\n", $feature->getName(),
@@ -197,15 +197,15 @@
 Now let's look at our streaming methods. Here's where we call the server-side streaming method `ListFeatures`, which returns a stream of geographical `Feature`s:
 
 ```php
-  $lo_point = new examples\Point();
-  $hi_point = new examples\Point();
+  $lo_point = new routeguide\Point();
+  $hi_point = new routeguide\Point();
 
   $lo_point->setLatitude(400000000);
   $lo_point->setLongitude(-750000000);
   $hi_point->setLatitude(420000000);
   $hi_point->setLongitude(-730000000);
 
-  $rectangle = new examples\Rectangle();
+  $rectangle = new routeguide\Rectangle();
   $rectangle->setLo($lo_point);
   $rectangle->setHi($hi_point);
 
@@ -219,12 +219,12 @@
 
 The `$call->responses()` method call returns an iterator. When the server sends a response, a `$feature` object will be returned in the `foreach` loop, until the server indiciates that there will be no more responses to be sent.
 
-The client-side streaming method `RecordRoute` is similar, except there we pass the method an iterator and get back a `examples\RouteSummary`.
+The client-side streaming method `RecordRoute` is similar, except there we pass the method an iterator and get back a `routeguide\RouteSummary`.
 
 ```php
   $points_iter = function($db) {
     for ($i = 0; $i < $num_points; $i++) {
-      $point = new examples\Point();
+      $point = new routeguide\Point();
       $point->setLatitude($lat);
       $point->setLongitude($long);
       yield $point;
@@ -245,7 +245,7 @@
 
 ```php
   foreach ($notes as $n) {
-    $route_note = new examples\RouteNote();
+    $route_note = new routerguide\RouteNote();
     $call->write($route_note);
   }
   $call->writesDone();
diff --git a/examples/php/route_guide/route_guide.php b/examples/php/route_guide/route_guide.php
index a836e03..76086f9 100644
--- a/examples/php/route_guide/route_guide.php
+++ b/examples/php/route_guide/route_guide.php
@@ -1,9 +1,9 @@
 <?php
 // DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
 // Source: route_guide.proto
-//   Date: 2015-06-12 00:32:41
+//   Date: 2015-08-31 21:11:45
 
-namespace examples {
+namespace routeguide {
 
   class Point extends \DrSlump\Protobuf\Message {
 
@@ -19,7 +19,7 @@
 
     public static function descriptor()
     {
-      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.Point');
+      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Point');
 
       // OPTIONAL INT32 latitude = 1
       $f = new \DrSlump\Protobuf\Field();
@@ -58,7 +58,7 @@
     /**
      * Clear <latitude> value
      *
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function clearLatitude(){
       return $this->_clear(1);
@@ -77,7 +77,7 @@
      * Set <latitude> value
      *
      * @param int $value
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function setLatitude( $value){
       return $this->_set(1, $value);
@@ -95,7 +95,7 @@
     /**
      * Clear <longitude> value
      *
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function clearLongitude(){
       return $this->_clear(2);
@@ -114,7 +114,7 @@
      * Set <longitude> value
      *
      * @param int $value
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function setLongitude( $value){
       return $this->_set(2, $value);
@@ -122,14 +122,14 @@
   }
 }
 
-namespace examples {
+namespace routeguide {
 
   class Rectangle extends \DrSlump\Protobuf\Message {
 
-    /**  @var \examples\Point */
+    /**  @var \routeguide\Point */
     public $lo = null;
     
-    /**  @var \examples\Point */
+    /**  @var \routeguide\Point */
     public $hi = null;
     
 
@@ -138,7 +138,7 @@
 
     public static function descriptor()
     {
-      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.Rectangle');
+      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Rectangle');
 
       // OPTIONAL MESSAGE lo = 1
       $f = new \DrSlump\Protobuf\Field();
@@ -146,7 +146,7 @@
       $f->name      = "lo";
       $f->type      = \DrSlump\Protobuf::TYPE_MESSAGE;
       $f->rule      = \DrSlump\Protobuf::RULE_OPTIONAL;
-      $f->reference = '\examples\Point';
+      $f->reference = '\routeguide\Point';
       $descriptor->addField($f);
 
       // OPTIONAL MESSAGE hi = 2
@@ -155,7 +155,7 @@
       $f->name      = "hi";
       $f->type      = \DrSlump\Protobuf::TYPE_MESSAGE;
       $f->rule      = \DrSlump\Protobuf::RULE_OPTIONAL;
-      $f->reference = '\examples\Point';
+      $f->reference = '\routeguide\Point';
       $descriptor->addField($f);
 
       foreach (self::$__extensions as $cb) {
@@ -177,7 +177,7 @@
     /**
      * Clear <lo> value
      *
-     * @return \examples\Rectangle
+     * @return \routeguide\Rectangle
      */
     public function clearLo(){
       return $this->_clear(1);
@@ -186,7 +186,7 @@
     /**
      * Get <lo> value
      *
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function getLo(){
       return $this->_get(1);
@@ -195,10 +195,10 @@
     /**
      * Set <lo> value
      *
-     * @param \examples\Point $value
-     * @return \examples\Rectangle
+     * @param \routeguide\Point $value
+     * @return \routeguide\Rectangle
      */
-    public function setLo(\examples\Point $value){
+    public function setLo(\routeguide\Point $value){
       return $this->_set(1, $value);
     }
     
@@ -214,7 +214,7 @@
     /**
      * Clear <hi> value
      *
-     * @return \examples\Rectangle
+     * @return \routeguide\Rectangle
      */
     public function clearHi(){
       return $this->_clear(2);
@@ -223,7 +223,7 @@
     /**
      * Get <hi> value
      *
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function getHi(){
       return $this->_get(2);
@@ -232,23 +232,23 @@
     /**
      * Set <hi> value
      *
-     * @param \examples\Point $value
-     * @return \examples\Rectangle
+     * @param \routeguide\Point $value
+     * @return \routeguide\Rectangle
      */
-    public function setHi(\examples\Point $value){
+    public function setHi(\routeguide\Point $value){
       return $this->_set(2, $value);
     }
   }
 }
 
-namespace examples {
+namespace routeguide {
 
   class Feature extends \DrSlump\Protobuf\Message {
 
     /**  @var string */
     public $name = null;
     
-    /**  @var \examples\Point */
+    /**  @var \routeguide\Point */
     public $location = null;
     
 
@@ -257,7 +257,7 @@
 
     public static function descriptor()
     {
-      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.Feature');
+      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Feature');
 
       // OPTIONAL STRING name = 1
       $f = new \DrSlump\Protobuf\Field();
@@ -273,7 +273,7 @@
       $f->name      = "location";
       $f->type      = \DrSlump\Protobuf::TYPE_MESSAGE;
       $f->rule      = \DrSlump\Protobuf::RULE_OPTIONAL;
-      $f->reference = '\examples\Point';
+      $f->reference = '\routeguide\Point';
       $descriptor->addField($f);
 
       foreach (self::$__extensions as $cb) {
@@ -295,7 +295,7 @@
     /**
      * Clear <name> value
      *
-     * @return \examples\Feature
+     * @return \routeguide\Feature
      */
     public function clearName(){
       return $this->_clear(1);
@@ -314,7 +314,7 @@
      * Set <name> value
      *
      * @param string $value
-     * @return \examples\Feature
+     * @return \routeguide\Feature
      */
     public function setName( $value){
       return $this->_set(1, $value);
@@ -332,7 +332,7 @@
     /**
      * Clear <location> value
      *
-     * @return \examples\Feature
+     * @return \routeguide\Feature
      */
     public function clearLocation(){
       return $this->_clear(2);
@@ -341,7 +341,7 @@
     /**
      * Get <location> value
      *
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function getLocation(){
       return $this->_get(2);
@@ -350,20 +350,20 @@
     /**
      * Set <location> value
      *
-     * @param \examples\Point $value
-     * @return \examples\Feature
+     * @param \routeguide\Point $value
+     * @return \routeguide\Feature
      */
-    public function setLocation(\examples\Point $value){
+    public function setLocation(\routeguide\Point $value){
       return $this->_set(2, $value);
     }
   }
 }
 
-namespace examples {
+namespace routeguide {
 
   class RouteNote extends \DrSlump\Protobuf\Message {
 
-    /**  @var \examples\Point */
+    /**  @var \routeguide\Point */
     public $location = null;
     
     /**  @var string */
@@ -375,7 +375,7 @@
 
     public static function descriptor()
     {
-      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.RouteNote');
+      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteNote');
 
       // OPTIONAL MESSAGE location = 1
       $f = new \DrSlump\Protobuf\Field();
@@ -383,7 +383,7 @@
       $f->name      = "location";
       $f->type      = \DrSlump\Protobuf::TYPE_MESSAGE;
       $f->rule      = \DrSlump\Protobuf::RULE_OPTIONAL;
-      $f->reference = '\examples\Point';
+      $f->reference = '\routeguide\Point';
       $descriptor->addField($f);
 
       // OPTIONAL STRING message = 2
@@ -413,7 +413,7 @@
     /**
      * Clear <location> value
      *
-     * @return \examples\RouteNote
+     * @return \routeguide\RouteNote
      */
     public function clearLocation(){
       return $this->_clear(1);
@@ -422,7 +422,7 @@
     /**
      * Get <location> value
      *
-     * @return \examples\Point
+     * @return \routeguide\Point
      */
     public function getLocation(){
       return $this->_get(1);
@@ -431,10 +431,10 @@
     /**
      * Set <location> value
      *
-     * @param \examples\Point $value
-     * @return \examples\RouteNote
+     * @param \routeguide\Point $value
+     * @return \routeguide\RouteNote
      */
-    public function setLocation(\examples\Point $value){
+    public function setLocation(\routeguide\Point $value){
       return $this->_set(1, $value);
     }
     
@@ -450,7 +450,7 @@
     /**
      * Clear <message> value
      *
-     * @return \examples\RouteNote
+     * @return \routeguide\RouteNote
      */
     public function clearMessage(){
       return $this->_clear(2);
@@ -469,7 +469,7 @@
      * Set <message> value
      *
      * @param string $value
-     * @return \examples\RouteNote
+     * @return \routeguide\RouteNote
      */
     public function setMessage( $value){
       return $this->_set(2, $value);
@@ -477,7 +477,7 @@
   }
 }
 
-namespace examples {
+namespace routeguide {
 
   class RouteSummary extends \DrSlump\Protobuf\Message {
 
@@ -499,7 +499,7 @@
 
     public static function descriptor()
     {
-      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.RouteSummary');
+      $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteSummary');
 
       // OPTIONAL INT32 point_count = 1
       $f = new \DrSlump\Protobuf\Field();
@@ -556,7 +556,7 @@
     /**
      * Clear <point_count> value
      *
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function clearPointCount(){
       return $this->_clear(1);
@@ -575,7 +575,7 @@
      * Set <point_count> value
      *
      * @param int $value
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function setPointCount( $value){
       return $this->_set(1, $value);
@@ -593,7 +593,7 @@
     /**
      * Clear <feature_count> value
      *
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function clearFeatureCount(){
       return $this->_clear(2);
@@ -612,7 +612,7 @@
      * Set <feature_count> value
      *
      * @param int $value
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function setFeatureCount( $value){
       return $this->_set(2, $value);
@@ -630,7 +630,7 @@
     /**
      * Clear <distance> value
      *
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function clearDistance(){
       return $this->_clear(3);
@@ -649,7 +649,7 @@
      * Set <distance> value
      *
      * @param int $value
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function setDistance( $value){
       return $this->_set(3, $value);
@@ -667,7 +667,7 @@
     /**
      * Clear <elapsed_time> value
      *
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function clearElapsedTime(){
       return $this->_clear(4);
@@ -686,7 +686,7 @@
      * Set <elapsed_time> value
      *
      * @param int $value
-     * @return \examples\RouteSummary
+     * @return \routeguide\RouteSummary
      */
     public function setElapsedTime( $value){
       return $this->_set(4, $value);
@@ -694,38 +694,36 @@
   }
 }
 
-namespace examples {
+namespace routeguide {
 
-  class RouteGuideClient{
+  class RouteGuideClient extends \Grpc\BaseStub {
 
-    private $rpc_impl;
-
-    public function __construct($rpc_impl) {
-      $this->rpc_impl = $rpc_impl;
+    public function __construct($hostname, $opts) {
+      parent::__construct($hostname, $opts);
     }
     /**
-     * @param examples\Point $input
+     * @param routeguide\Point $input
      */
-    public function GetFeature(\examples\Point $argument, $metadata = array()) {
-      return $this->rpc_impl->_simpleRequest('/examples.RouteGuide/GetFeature', $argument, '\examples\Feature::deserialize', $metadata);
+    public function GetFeature(\routeguide\Point $argument, $metadata = array(), $options = array()) {
+      return $this->_simpleRequest('/routeguide.RouteGuide/GetFeature', $argument, '\routeguide\Feature::deserialize', $metadata, $options);
     }
     /**
-     * @param examples\Rectangle $input
+     * @param routeguide\Rectangle $input
      */
-    public function ListFeatures($argument, $metadata = array()) {
-      return $this->rpc_impl->_serverStreamRequest('/examples.RouteGuide/ListFeatures', $argument, '\examples\Feature::deserialize', $metadata);
+    public function ListFeatures($argument, $metadata = array(), $options = array()) {
+      return $this->_serverStreamRequest('/routeguide.RouteGuide/ListFeatures', $argument, '\routeguide\Feature::deserialize', $metadata, $options);
     }
     /**
-     * @param examples\Point $input
+     * @param routeguide\Point $input
      */
-    public function RecordRoute($arguments, $metadata = array()) {
-      return $this->rpc_impl->_clientStreamRequest('/examples.RouteGuide/RecordRoute', $arguments, '\examples\RouteSummary::deserialize', $metadata);
+    public function RecordRoute($metadata = array()) {
+      return $this->_clientStreamRequest('/routeguide.RouteGuide/RecordRoute', '\routeguide\RouteSummary::deserialize', $metadata);
     }
     /**
-     * @param examples\RouteNote $input
+     * @param routeguide\RouteNote $input
      */
     public function RouteChat($metadata = array()) {
-      return $this->rpc_impl->_bidiRequest('/examples.RouteGuide/RouteChat', '\examples\RouteNote::deserialize', $metadata);
+      return $this->_bidiRequest('/routeguide.RouteGuide/RouteChat', '\routeguide\RouteNote::deserialize', $metadata);
     }
   }
 }
diff --git a/examples/php/route_guide/route_guide.proto b/examples/php/route_guide/route_guide.proto
index 0947184..d50f8a5 100644
--- a/examples/php/route_guide/route_guide.proto
+++ b/examples/php/route_guide/route_guide.proto
@@ -31,7 +31,7 @@
 
 option java_package = "io.grpc.examples";
 
-package examples;
+package routeguide;
 
 // Interface exported by the server.
 service RouteGuide {
diff --git a/examples/php/route_guide/route_guide_client.php b/examples/php/route_guide/route_guide_client.php
index 6d9ae58..d21a080 100644
--- a/examples/php/route_guide/route_guide_client.php
+++ b/examples/php/route_guide/route_guide_client.php
@@ -37,7 +37,7 @@
 
 define('COORD_FACTOR', 1e7);
 
-$client = new examples\RouteGuideClient(
+$client = new routeguide\RouteGuideClient(
   new Grpc\BaseStub('localhost:50051', []));
 
 function printFeature($feature) {
@@ -60,7 +60,7 @@
   print "Running GetFeature...\n";
   global $client;
 
-  $point = new examples\Point();
+  $point = new routeguide\Point();
   $points = array(
     array(409146138, -746188906),
     array(0, 0),
@@ -84,15 +84,15 @@
   print "Running ListFeatures...\n";
   global $client;
 
-  $lo_point = new examples\Point();
-  $hi_point = new examples\Point();
+  $lo_point = new routeguide\Point();
+  $hi_point = new routeguide\Point();
 
   $lo_point->setLatitude(400000000);
   $lo_point->setLongitude(-750000000);
   $hi_point->setLatitude(420000000);
   $hi_point->setLongitude(-730000000);
 
-  $rectangle = new examples\Rectangle();
+  $rectangle = new routeguide\Rectangle();
   $rectangle->setLo($lo_point);
   $rectangle->setHi($hi_point);
 
@@ -118,7 +118,7 @@
     $num_points_in_db = count($db);
     $num_points = 10;
     for ($i = 0; $i < $num_points; $i++) {
-      $point = new examples\Point();
+      $point = new routeguide\Point();
       $index = rand(0, $num_points_in_db - 1);
       $lat = $db[$index]['location']['latitude'];
       $long = $db[$index]['location']['longitude'];
@@ -163,11 +163,11 @@
   );
 
   foreach ($notes as $n) {
-    $point = new examples\Point();
+    $point = new routeguide\Point();
     $point->setLatitude($lat = $n[0]);
     $point->setLongitude($long = $n[1]);
 
-    $route_note = new examples\RouteNote();
+    $route_note = new routeguide\RouteNote();
     $route_note->setLocation($point);
     $route_note->setMessage($message = $n[2]);