google/grpc-gcp
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
google/auth | v1.39.0 | - | Apache-2.0 | prod dev | |
google/protobuf | v3.25.3 | - | BSD-3-Clause | prod | |
grpc/grpc | 1.57.0 | 166.59 kB | Apache-2.0 | prod | |
psr/cache | 3.0.0 | 6.01 kB | MIT | prod |
The google/grpc-gcp package is a unique Google Cloud Platform (GCP) specific extension for gRPC. gRPC is a high-performance, open-source RPC framework developed by Google. This package essentially enhances the abilities of the gRPC in a GCP environment. With its efficient channel management capabilities, it aids in optimizing the use of gRPC channels, thereby leading to a reduction in resources and improved performance.
To utilize the google/grpc-gcp package, you would need to first install it using the Composer dependency management tool. Add the following line in your composer.json
file under the require
section:
{
"require": {
"google/grpc-gcp": "^0.1.4"
}
}
Then, run the composer update
command.
After this, you can incorporate the google/grpc-gcp package in your PHP application as follows:
<?php
require 'vendor/autoload.php';
use Google\Cloud\Spanner\V1\SpannerClient;
use Google\Cloud\Spanner\V1\Gapic\SpannerGapicClient;
use Google\Cloud\Spanner\V1\Session;
function simpleApiCall()
{
$spannerClient = new SpannerClient();
$session = (new Session())->setName('projects/my_project/instances/my_instance/databases/my_database/sessions/my_session');
$tx = $spannerClient->beginTransaction($session);
$query = 'SELECT * FROM my_table';
$resultSet = $spannerClient->executeSql($tx, $query);
foreach ($resultSet as $row) {
echo $row;
}
}
// make the API call
simpleApiCall();
Please replace 'my_project', 'my_instance', 'my_database', 'my_session', and 'my_table' with the applicable values for your GCP project and Spanner database.
To find the detailed documentation for the google/grpc-gcp package, refer to the src directory in the package's GitHub repository. This would contain documents and code snippets providing an in-depth understanding of the package and its usage. Note that since this is a comparatively specialized package, the examples and documentation may not be as complete as with more widely-used packages. For a broader understanding of gRPC as a whole, the main gRPC project may be a useful reference point.