vitess-gh/php
Alain Jobart 299e3a2e4c Revert "Merge pull request #2191 from alainjobart/bind"
This reverts commit 38749981ea, reversing
changes made to 189b5b455d.
2016-11-04 10:48:25 -07:00
..
pdo@5bd671c129 Adding result of merge (I think) 2016-05-11 07:55:57 -07:00
src 2pc (#2153) 2016-10-18 09:50:14 -07:00
tests Revert "Merge pull request #2191 from alainjobart/bind" 2016-11-04 10:48:25 -07:00
README.md Update to gRPC 1.0.0 and protobuf 3.0.0. (#2012) 2016-09-23 11:41:17 -07:00

README.md

Vitess PHP

This folder contains the PHP client for Vitess.

For a simple example of using the API, see the [client.php] (https://github.com/youtube/vitess/blob/master/examples/local/client.php) script, which works with the environment created by the [local setup example] (http://vitess.io/getting-started/local-instance.html).

There is also a similar example client for the [VTGateV3 demo] (https://github.com/youtube/vitess/tree/master/examples/demo) environment.

Prerequisites

PHP 5.5+ is required.

gRPC Extension Module

Install the gRPC extension module.

For example, on Debian/Ubuntu:

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

gRPC Dependencies

To download the dependencies of the gRPC PHP library, run Composer:

$ cd vitess
vitess$ curl -sS https://getcomposer.org/installer | php
vitess$ php composer.phar install

Unit Tests

To run the tests, first install PHPUnit:

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

Then run the tests like this:

vitess$ . dev.env
vitess$ make php_test

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$ phpunit --coverage-html php/_test

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