cbws / php-cbws-grpc
Generated gRPC client libraries for CBWS
Requires
- google/common-protos: ^4.11
- google/protobuf: ^4.30 || ^5.0
- grpc/grpc: ^1.57
- guzzlehttp/guzzle: ^7.8 || ^8.0
Requires (Dev)
None
Suggests
- ext-grpc: For native gRPC; without it, the clients use gRPC-Web
- ext-protobuf: For better performance, use the C implementation of Protobuf
- google/protobuf: In case the C implementation of Protobuf is not suitable, use the PHP one
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v0.100.1
- v0.100.0
- v0.99.0
- v0.98.0
- v0.97.0
- v0.96.0
- v0.95.2
- v0.95.1
- v0.95.0
- v0.94.1
- v0.94.0
- v0.93.0
- v0.92.0
- v0.91.0
- v0.90.0
- v0.89.0
- v0.88.0
- v0.87.0
- v0.86.0
- v0.85.0
- v0.84.0
- v0.83.0
- v0.82.0
- v0.81.0
- v0.80.0
- v0.79.0
- v0.78.0
- v0.77.0
- v0.76.0
- v0.75.0
- v0.74.0
- v0.73.0
- v0.72.0
- v0.71.0
- v0.70.0
- v0.69.0
- v0.68.0
- v0.67.0
- v0.66.0
- v0.65.0
- v0.64.0
- v0.63.0
- v0.62.0
- v0.61.0
- v0.60.0
- v0.59.0
- v0.58.0
- v0.57.0
- v0.56.0
- v0.55.0
- v0.54.0
- v0.53.0
- v0.52.0
- v0.51.0
- v0.50.0
- v0.49.2
- v0.49.1
- v0.49.0
- v0.48.0
- v0.47.0
- v0.46.0
- v0.45.0
- v0.44.0
- v0.43.0
- v0.42.0
- v0.41.0
- v0.40.0
- v0.39.0
- v0.38.0
- v0.37.0
- v0.36.1
- v0.36.0
- v0.35.0
- v0.34.0
- v0.33.1
- v0.33.0
- v0.32.4
- v0.32.3
- v0.32.2
- v0.32.1
- v0.32.0
- v0.31.1
- v0.31.0
- v0.30.0
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.0
- v0.9.0
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.8.3
- v0.5.8.2
- v0.5.8.1
- v0.5.8
- v0.5.7
- v0.5.6
- v0.5.5
- v0.5.4
- v0.5.3
- v0.5.2.3
- v0.5.2.2
- v0.5.2.1
- v0.5.2
- v0.5.1.3
- v0.5.1.2
- v0.5.1.1
- v0.5.1
- v0.5.0
- v0.4.3.1
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.4
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.0
- v0.1.0
- v0.0.15
- v0.0.14
- v0.0.13
- v0.0.12
- v0.0.11
- v0.0.10
- v0.0.9
- v0.0.8.1
- v0.0.8
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
- dev-projects
This package is auto-updated.
Last update: 2026-10-27 07:48:16 UTC
README
This repository contains the PHP classes for the public CBWS APIs: the messages and the clients. A process generates them from the definitions in cbws/protobufs. Do not change the generated files by hand. The transport classes in src/Transport are not generated.
Installation
To install the package with Composer, run this command:
composer require cbws/php-cbws-grpc
The grpc PHP extension is optional. Without it, the clients use gRPC-Web over HTTPS. The protobuf PHP extension is optional and gives better performance.
Usage
Create one transport for each API endpoint. Give the same transport to every client for that endpoint.
use Cbws\Grpc\Compute\V1alpha1\ComputeServiceClient; use Cbws\Grpc\Compute\V1alpha1\ListMachinesRequest; use Cbws\Grpc\Transport\Transports; $transport = Transports::create('compute.cbws.cloud:443', [ 'metadata_provider' => fn (array $metadata): array => $metadata + ['authorization' => ['Bearer ' . $token]], ]); $compute = new ComputeServiceClient($transport); [$response, $status] = $compute->ListMachines(new ListMachinesRequest(['parent' => 'projects/my-project']))->wait(); if ($status->code !== \Cbws\Grpc\Transport\Status::OK) { throw new RuntimeException($status->details); }
Transports::create() selects the transport:
- If the
grpcextension is loaded, it uses native gRPC. - If the extension is not loaded, it uses gRPC-Web.
- To use gRPC-Web when the extension is loaded, set
'transport' => 'grpc-web'.
Send credentials with metadata_provider. It runs before every call.
Code written for the gRPC extension's clients
Earlier versions of this package generated clients that extend \Grpc\BaseStub. The clients now have the same names and methods, but they call a Cbws\Grpc\Transport\Transport:
new ComputeServiceClient($hostname, ['credentials' => ...])still works and uses native gRPC.- A method returns a
Cbws\Grpc\Transport\UnaryCall. Itswait()gives[$response, $status], as before.$statushas the samecode,detailsandmetadataproperties. - Code that uses the types
\Grpc\BaseStubor\Grpc\UnaryCallmust change.
Versions
The tags of this repository have the same version numbers as the tags of cbws/protobufs. Each commit names the commit of cbws/protobufs it was generated from.
License
The package is available under the Apache License, Version 2.0. Refer to the LICENSE file.