google/cloud-common-protos
Generated PHP Protocol Buffer classes shared across Google Cloud APIs (part of google-cloud-php). Install via Composer as google/cloud-common-protos to use stable, Apache-2.0 licensed common proto message types in your apps.
AuditLog, Status, HttpRequest) across integrations, reducing custom serialization logic and ensuring consistency with Google’s API standards. Critical for projects requiring compliance with Google Cloud Audit Logs, IAM policies, or gRPC-based services.google/cloud-logging, google/cloud-pubsub) as a strategic dependency. This package is a foundational component for these SDKs, handling authentication, retries, and schema evolution—reducing reinvention risk and ensuring compliance with Google’s API contracts.PermissionType, OperationMetadata). Mitigates migration costs when Google updates schemas (e.g., deprecating ReservationResourceUsage).Google\Rpc\Status format for consistency with GCP services and improved debugging.Google\Logging\Type\HttpRequest for observability (e.g., tracing, analytics).laravel-google-cloud) that interact with Google Cloud APIs and require shared protobuf schemas for consistency.google/cloud-storage, google/cloud-logging) and extending their protobuf-based functionality without reinventing the wheel.google/protobuf) and immutable DTO patterns in Laravel.laravel-google-cloud).google/protobuf), complicating CI/CD or production setups.*"This package provides the official protobuf schemas for Google Cloud’s PHP APIs, enabling our Laravel applications to exchange data seamlessly with services like Audit Logs, IAM, or Pub/Sub. By adopting it—either directly or through Google’s official SDKs—we eliminate custom serialization work, reduce technical debt, and future-proof our integrations against Google’s evolving APIs. This is particularly valuable if we’re investing in Google Cloud for compliance, security, or high-performance internal tools.
Key Benefits:
PermissionType, OperationMetadata).Trade-offs:
google/protobuf), which may add deployment complexity.Recommendation: Adopt this package indirectly via Google Cloud SDKs unless you need raw protobuf access for custom gRPC services. This aligns with our roadmap to standardize data models and reduce reinvention."*
composer require google/cloud-logging), which automatically includes google/cloud-common-protos.use Google\Cloud\Logging\LoggingClient;
$logging = new LoggingClient();
$entry = $logging->entry('my-log', ['message' => 'Hello, Google Cloud!']);
The SDK handles protobuf serialization internally.composer.json:
"google/cloud-common-protos": "^1.0"
use Google\Logging\Type\LogEntry;
use Google\Protobuf\Internal\Message;
$entry = new LogEntry();
$entry->setSeverity('INFO');
$entry->setMessage('Custom protobuf log entry');
$entry->setHttpRequest($httpRequestProto); // Extend with custom protobuf fields
$this->app->singleton(LoggingClient::class, function ($app) {
return new LoggingClient(['keyFilePath' => $app['config']['google.cloud.key']]);
});
public function handle($request, Closure $next) {
$protoPayload = $request->get('proto_payload');
if (!$protoPayload instanceof Message) {
throw new \InvalidArgumentException('Invalid protobuf payload');
}
return $next($request);
}
use Google\Logging\Type\HttpRequest;
$httpRequest = new HttpRequest();
$httpRequest->setRequestUrl($request->fullUrl());
$httpRequest->setRequestMethod($request->method());
Log::withProtoMetadata($httpRequest)->info('User action logged');
google/protobuf extension is installed (pecl install protobuf).PermissionType changes) to avoid breaking changes.Google\Protobuf\Internal\TestUtil for unit testing protobuf objects.google/cloud-core or custom JSON serialization.Next Steps:
How can I help you explore Laravel packages today?