google/common-protos
Generated PHP classes for Google’s common Protocol Buffer types used across the Google API ecosystem. Distributed as the google/common-protos Composer package under Apache 2.0 and designed to be stable for use in your applications.
google/gax-php or custom gRPC-PHP integrations).google/protobuf (≥v4.0.0, per changelog), which is a heavy but stable dependency (~10MB).symfony/serializer) if Protobuf’s serialization overlaps.php-protobuf)..proto files.| Risk Area | Mitigation Strategy |
|---|---|
| Protobuf Version Lock | Pin google/protobuf to ^5.0 in composer.json to avoid breaking changes (e.g., v4 deprecation in v4.8.3). |
| Binary Compatibility | Test with google/cloud-* packages (e.g., google/cloud-storage) to ensure proto versions align. |
| Performance Bottlenecks | Profile serialization with blackfire.io; cache frequently used proto objects. |
| Debugging Complexity | Use google/protobuf/src/Google/Protobuf/Internal/Util for debugging tools (e.g., debugString). |
| Schema Evolution | Monitor Google’s AIP-213 for backward-compatible changes. |
json_encode) may suffice.grpc/grpc + google/gax-php for tighter integration.google/cloud-* SDKs (e.g., Storage, Logging).grpc/grpc for high-performance RPC.| Phase | Action | Tools/Dependencies |
|---|---|---|
| Assessment | Audit existing payloads; identify Protobuf-compatible schemas (e.g., Google API configs). | protoc (for schema validation), composer why |
| Pilot Integration | Replace 1–2 JSON endpoints with Protobuf (e.g., a BigQuery job config). | google/cloud-bigquery, google/protobuf |
| Core Adoption | Standardize Protobuf for: |
google/gax-php, laravel-grpc (if needed) |
| Full Rollout | Deprecate JSON for internal services; expose Protobuf-only APIs to clients. | API Gateway (e.g., Envoy), CI checks |google/protobuf:^5.0 (per v4.12.5 changelog).google/protobuf:^5.28 (latest stable as of 2026).php artisan google:deploy).composer require google/common-protos google/protobuf:^5.28
.proto files from existing JSON schemas using protoc or Google’s AIP tools.syntax = "proto3";
import "google/api/annotations.proto";
message MyRequest {
string user_id = 1;
repeated string tags = 2;
}
use Google\Api\MyRequest;
$request = new MyRequest();
$request->setUserId('123');
$serialized = $request->serializeToString();
class GoogleProtobufService {
public function serialize(MyRequest $request): string {
return $request->serializeToString();
}
}
google/cloud-storage).composer update google/common-protos --with-dependencies.longrunning classes).protoc to validate custom .proto files against Google’s templates.protoc --php_out=. my_schema.proto).InvalidProtocolBufferException: Validate payloads with MyProto::parseFromString($data).DateTime; use google/protobuf/timestamp.proto instead).error_log($proto->debugString()) for human-readable dumps.google-protobuf + php.How can I help you explore Laravel packages today?