mlumish | b892a27 | 2014-12-09 16:28:23 -0800 | [diff] [blame^] | 1 | # PHP wrapper for the GRPC interfaces. |
| 2 | |
| 3 | ## LAYOUT |
| 4 | |
| 5 | Directory structure is as generated by the PHP utility |
| 6 | [ext_skel](http://php.net/manual/en/internals2.buildsys.skeleton.php) |
| 7 | |
| 8 | ## ENVIRONMENT |
| 9 | |
| 10 | To build a PHP environment that works with this extension, download and extract |
| 11 | PHP 5.5 (5.6 may also work), configure it, and install it: |
| 12 | |
| 13 | ```bash |
| 14 | apt-get install libxml2 libxml2-dev |
| 15 | curl http://php.net/get/php-5.5.16.tar.gz |
| 16 | tar -xf php-5.5.16.tar.gz |
| 17 | cd php-5.5.16 |
| 18 | ./configure --with-zlib=/usr --with-libxml-dir=ext/libxml --with-openssl=/usr/local/ssl |
| 19 | make |
| 20 | make install |
| 21 | ``` |
| 22 | |
| 23 | To also download and install the patched protoc and PHP code generator: |
| 24 | |
| 25 | ```bash |
| 26 | apt-get install -y procps |
| 27 | curl -sSL https://get.rvm.io | sudo bash -s stable --ruby |
| 28 | git clone sso://team/one-platform-grpc-team/protobuf |
| 29 | cd protobuf |
| 30 | ./configure |
| 31 | make |
| 32 | make install |
| 33 | git clone sso://team/one-platform-grpc-team/grpc-php-protobuf-php |
| 34 | cd grpc-php-protobuf-php |
| 35 | rake pear:package version=1.0 |
| 36 | pear install Protobuf-1.0.tgz |
| 37 | ``` |
| 38 | |
| 39 | ## BUILDING |
| 40 | |
| 41 | 1. In ./ext/grpc, run the command `phpize` (distributed with PHP) |
| 42 | 2. Run `./ext/grpc/configure` |
| 43 | 3. In ./ext/grpc, run `make` and `sudo make install` |
| 44 | 4. In your php.ini file, add the line `extension=grpc.so` to load the |
| 45 | extension at PHP startup. |
| 46 | |
| 47 | ## PHPUnit |
| 48 | |
| 49 | This repo now has PHPUnit tests, which can by run by executing |
| 50 | `./bin/run_tests.sh` after building. |
| 51 | |
| 52 | There is also a generated code test (`./bin/run_gen_code_test.sh`), which tests |
| 53 | the stub `./tests/generated_code/math.php` against a running localhost server |
| 54 | serving the math service. That stub is generated from |
| 55 | `./tests/generated_code/math.proto` with the head of the repo |
| 56 | `sso://team/one-platform-grpc-team/grpc-php-protobuf-php`. |