google/gax
Google API Core for PHP (gax-php) provides shared components used by generated Google Cloud API clients, including gRPC-based call handling, retries, timeouts, and page streaming. Designed for PHP 8.1+ and Google API conventions; most users won’t call it directly.
googleapis/googleapis), reducing manual boilerplate.TransportCallMiddleware, GapicClientTrait::prependMiddleware) for intercepting requests/responses, useful for logging, auth, or metrics.google/protobuf (v5+), which may need manual installation (pecl install protobuf).grpc/grpc), which must be installed system-wide (not via Composer).google/protobuf and grpc/grpc may cause conflicts if versions drift.CredentialsWrapper but may need customization.ApiException (e.g., structured error details)?googleapis/googleapis (for auto-generated API clients).grpc/grpc (gRPC-PHP bindings).google/protobuf (Protobuf support).pecl protobuf and grpc/grpc extensions..proto files (if not using auto-generated clients).composer require google/gax
composer require google/protobuf
composer require grpc/grpc
FirestoreClient) or manually instantiate GapicClientTrait-based clients.use Google\ApiCore\ApiException;
use Google\Cloud\Firestore\V1\FirestoreClient;
$client = new FirestoreClient([
'credentials' => $serviceAccountCredentials,
]);
GapicClientTrait or use TransportCallMiddleware for cross-cutting concerns (e.g., logging).ApiException::getErrorDetails()).google/protobuf to v5.x to avoid breaking changes (see #661).CredentialsWrapper may be needed for non-standard auth.TransportCallMiddleware).google/gax, google/protobuf, and grpc/grpc for breaking changes.composer.json to avoid surprises (e.g., Protobuf v5+ deprecations)..proto schemas.ApiException::getErrorDetails() for structured error info.Grpc\ChannelCredentials) for high-throughput apps.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| gRPC transport unavailable | API calls fail silently | Implement REST fallback or circuit breakers. |
| Protobuf schema mismatch | Serialization/deserialization errors | Validate schemas pre-deployment. |
| Authentication token expiry | ApiException with auth errors |
Use CredentialsWrapper with refresh logic. |
| High gRPC latency | Timeouts or degraded performance | Adjust CallOptions timeouts; monitor metrics. |
| PHP-FPM crashes due to gRPC memory | Worker restarts, downtime | Optimize Protobuf payloads; increase memory. |
ApiException).pecl protobuf and grpc/grpc in CI.How can I help you explore Laravel packages today?