php client for digota
PREREQUISITES
php
>=5.5phpize
pecl
phpunit
composer
protoc
Composer
composer require digota/digota-php
{
"name": "your project",
"require": {
"digota/digota-php": "dev-master"
}
}
<?php
require dirname(__FILE__).'/vendor/autoload.php';
$client = new \Productpb\ProductServiceClient('localhost:3051', [
// send client cert
'credentials' => Grpc\ChannelCredentials::createSsl(file_get_contents(dirname(__FILE__).'/client.com.pem'))
//'credentials' => Grpc\ChannelCredentials::createInsecure()
]);
$request = new Productpb\GetRequest();
$request->SetId("e5aae05c-880c-11e7-ba5e-6354e0d1e8c5");
// async
var_dump($client->Get($request));
// sync
var_dump($client->Get($request)->wait());