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."*
*"This package is a critical dependency for any Laravel project integrating with Google Cloud services that use protobuf schemas (e.g., Cloud Logging, Pub/Sub, IAM). Here’s how to leverage it effectively:
1. Indirect Adoption (Recommended for Most Cases):
composer require google/cloud-logging) to automatically include google/cloud-common-protos as a dependency. This is the simplest path for most use cases.Google\Cloud\Logging\LoggingClient for structured logging, which internally relies on protobuf schemas from this package.2. Direct Adoption (For Custom Protobuf Needs):
composer.json:
"google/cloud-common-protos": "^1.0"
Google\Protobuf\Internal\Message) to build custom protobuf payloads for gRPC services or advanced integrations.Google\Logging\Type\LogEntry to add custom metadata fields while maintaining compatibility with Google’s schema.3. Integration with Laravel:
$this->app->singleton(LoggingClient::class, function ($app) {
return new LoggingClient(['keyFilePath' => $app['config']['google.cloud.key']]);
});
$logEntry = (new LogEntry())
->setTimestamp(new \Google\Type\Timestamp())
->setSeverity('INFO');
Google\Logging\Type\HttpRequest to enrich Laravel logs with HTTP metadata:
$request = (new HttpRequest())
->setRequestUrl('https://api.example.com')
->setRequestMethod('GET');
Key Considerations:
google/protobuf (PHP extensions). Test with:
composer require google/protobuf
PermissionType changes) to avoid breaking changes. Use semantic versioning (^1.0) for stability.isInitialized()) to catch malformed payloads early.google/cloud-core or custom JSON serialization instead.Example Workflow (Audit Logs):
composer require google/cloud-logging
$client = new LoggingClient();
$entry = (new LogEntry())
->setLogName('projects/my-project/logs/audit')
->setSeverity('INFO')
->setJsonPayload(json_encode(['user_id' => 123]));
$client->entries()->write($entry);
$entries = $client->entries()->listEntries('projects/my-project/logs/audit');
foreach ($entries as $entry) {
$payload = json_decode($entry->getJsonPayload(), true);
// Process payload...
}
```"
How can I help you explore Laravel packages today?