• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1gRPC in 3 minutes (PHP)
2===========================
3
4PREREQUISITES
5-------------
6
7This requires `php` >=5.5, `phpize`, `pecl`, `phpunit`
8
9INSTALL
10-------
11 - Install the gRPC PHP extension
12
13   ```sh
14   $ [sudo] pecl install grpc
15   ```
16
17 - Clone this repository
18
19   ```sh
20   $ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
21   ```
22
23 - Install composer
24
25   ```
26   $ cd examples/php
27   $ curl -sS https://getcomposer.org/installer | php
28   $ php composer.phar install
29   ```
30
31TRY IT!
32-------
33
34 - Run the server
35
36   Please follow the instruction in [Node][] to run the server
37   ```
38   $ cd examples/node
39   $ npm install
40   $ cd dynamic_codegen or cd static_codegen
41   $ node greeter_server.js
42   ```
43
44 - Generate proto files and run the client
45
46   ```
47   $ cd examples/php
48   $ ./greeter_proto_gen.sh
49   $ ./run_greeter_client.sh
50   ```
51
52NOTE
53----
54
55This directory has a copy of `helloworld.proto` because it currently depends on
56some Protocol Buffer 2.0 syntax. There is no proto3 support for PHP yet.
57
58TUTORIAL
59--------
60
61You can find a more detailed tutorial in [gRPC Basics: PHP][]
62
63[Node]:https://github.com/grpc/grpc/tree/master/examples/node
64[gRPC Basics: PHP]:https://grpc.io/docs/tutorials/basic/php.html
65