Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A minimal test script to ensure that a PHP server can access data in Google BigTable (tests scopes, credentials, GRPC, and protobuf)
<?php
require 'vendor/autoload.php';
use Google\Cloud\Bigtable\BigtableClient;
$project_id = 'my-project-id';
$instance_id = 'my-instance-id';
$table_id = 'my-table-id';
$credential_file_path = './credential.json';
$transport = 'grpc';
// Connect to an existing table with an existing instance.
$dataClient = new BigtableClient([
'projectId' => $project_id,
'credentials' => $credential_file_path,
'transport' => $transport,
]);
$table = $dataClient->table($instance_id, $table_id);
// Read multiple rows
$rows = $table->readRows(['rowsLimit' => 2]);
foreach ($rows as $row) {
print_r($row) . PHP_EOL;
}
@craigafinch

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment