Jayant Kolhe | 300748e | 2015-02-19 11:30:40 -0800 | [diff] [blame] | 1 | |
| 2 | #Overview |
| 3 | |
| 4 | This directory contains source code for PHP implementation of gRPC layered on shared C library. |
| 5 | |
| 6 | #Status |
| 7 | |
Jayant Kolhe | 691dbcc | 2015-02-19 11:31:20 -0800 | [diff] [blame^] | 8 | Pre-Alpha : This gRPC PHP implementation is work-in-progress and is not expected to work yet. |
Jayant Kolhe | 300748e | 2015-02-19 11:30:40 -0800 | [diff] [blame] | 9 | |
mlumish | b892a27 | 2014-12-09 16:28:23 -0800 | [diff] [blame] | 10 | |
| 11 | ## LAYOUT |
| 12 | |
| 13 | Directory structure is as generated by the PHP utility |
| 14 | [ext_skel](http://php.net/manual/en/internals2.buildsys.skeleton.php) |
| 15 | |
| 16 | ## ENVIRONMENT |
| 17 | |
murgatroid99 | 975a07b | 2015-02-02 14:10:42 -0800 | [diff] [blame] | 18 | Install `php5` and `php5-dev`. |
mlumish | b892a27 | 2014-12-09 16:28:23 -0800 | [diff] [blame] | 19 | |
murgatroid99 | 975a07b | 2015-02-02 14:10:42 -0800 | [diff] [blame] | 20 | To run the tests, additionally install `php5-readline` and `phpunit`. |
mlumish | b892a27 | 2014-12-09 16:28:23 -0800 | [diff] [blame] | 21 | |
murgatroid99 | 975a07b | 2015-02-02 14:10:42 -0800 | [diff] [blame] | 22 | Alternatively, build and install PHP 5.5 or later from source with standard |
| 23 | configuration options. |
| 24 | |
| 25 | To also download and install protoc and the PHP code generator. |
mlumish | b892a27 | 2014-12-09 16:28:23 -0800 | [diff] [blame] | 26 | |
| 27 | ```bash |
| 28 | apt-get install -y procps |
| 29 | curl -sSL https://get.rvm.io | sudo bash -s stable --ruby |
murgatroid99 | 975a07b | 2015-02-02 14:10:42 -0800 | [diff] [blame] | 30 | git clone git@github.com:google/protobuf.git |
mlumish | b892a27 | 2014-12-09 16:28:23 -0800 | [diff] [blame] | 31 | cd protobuf |
| 32 | ./configure |
| 33 | make |
| 34 | make install |
murgatroid99 | 975a07b | 2015-02-02 14:10:42 -0800 | [diff] [blame] | 35 | git clone git@github.com:murgatroid99/Protobuf-PHP.git |
| 36 | cd Protobuf-PHP |
mlumish | b892a27 | 2014-12-09 16:28:23 -0800 | [diff] [blame] | 37 | rake pear:package version=1.0 |
| 38 | pear install Protobuf-1.0.tgz |
| 39 | ``` |
| 40 | |
| 41 | ## BUILDING |
| 42 | |
| 43 | 1. In ./ext/grpc, run the command `phpize` (distributed with PHP) |
| 44 | 2. Run `./ext/grpc/configure` |
| 45 | 3. In ./ext/grpc, run `make` and `sudo make install` |
| 46 | 4. In your php.ini file, add the line `extension=grpc.so` to load the |
| 47 | extension at PHP startup. |
| 48 | |
| 49 | ## PHPUnit |
| 50 | |
| 51 | This repo now has PHPUnit tests, which can by run by executing |
| 52 | `./bin/run_tests.sh` after building. |
| 53 | |
| 54 | There is also a generated code test (`./bin/run_gen_code_test.sh`), which tests |
| 55 | the stub `./tests/generated_code/math.php` against a running localhost server |
| 56 | serving the math service. That stub is generated from |
murgatroid99 | 975a07b | 2015-02-02 14:10:42 -0800 | [diff] [blame] | 57 | `./tests/generated_code/math.proto`. |