vitess-gh/php
Anthony Yeh 65d6dbb082 php: Generate gRPC service stubs from protobuf.
I followed the instructions here:

http://www.grpc.io/docs/installation/php.html

Then used the protoc-gen-php built in that process to generate stubs for
our protos.
2015-09-25 16:31:27 -07:00
..
src php: Generate gRPC service stubs from protobuf. 2015-09-25 16:31:27 -07:00
tests Changing type used by ExecuteEntityIds to be the proto3 one. 2015-08-31 08:11:37 -07:00
README.md php: Fix phpunit install step in README. 2015-08-24 15:53:01 -07:00
demo.php php: First pass at new PHP client. 2015-08-22 16:17:54 -07:00

README.md

Vitess PHP

This folder contains the PHP client for Vitess.

See demo.php for a simple example of using the API.

Prerequisites

PHP 5.3+ is required.

This library uses the BSON codec library contained within the MongoDB plugin. For example, you can install this on Debian/Ubuntu like this:

$ sudo apt-get install php5-dev php5-cli php-pear
$ sudo pecl install mongo

Unit Tests

To run the tests, first install PHPUnit:

$ wget https://phar.phpunit.de/phpunit.phar
$ mv phpunit.phar $VTROOT/bin/phpunit
$ chmod +x $VTROOT/bin/phpunit

Then run the tests like this:

vitess/php$ phpunit tests

Coverage

In addition to PHPUnit, you also need to install xdebug, if you want to see coverage:

$ sudo pecl install xdebug
[...]
Build process completed successfully
Installing '/usr/lib/php5/20121212/xdebug.so'

# Where should we put the ini file?
$ php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d

# Make an ini file for xdebug.
$ sudo sh -c "echo \"zend_extension=$(pecl config-get ext_dir default)/xdebug.so\" > /etc/php5/cli/conf.d/20-xdebug.ini"

# Check that xdebug is being loaded.
$ php -m | grep xdebug
xdebug

Then you can run a coverage check with PHPUnit:

vitess/php$ phpunit --coverage-html _test tests

# Open in browser.
vitess/php$ xdg-open _test/index.html