google/cloud-common-protos
PHP classes generated from the protocol buffer types shared across multiple Google Cloud APIs. Stable and backward-compatible, this Apache 2.0 licensed Composer package lets you depend on these common protos directly via composer require google/cloud-common-protos.
Architecture fit
google/cloud-common-protos is a contract layer, not an application layer. It ships generated PHP classes for shared protobuf types (google.rpc.Status, google.type.*, google.longrunning.Operation, audit-log and HTTP-request messages) that Google Cloud APIs reuse. For a Laravel/PHP product the realistic architecture position is:
google/cloud-logging, google/cloud-pubsub, google/cloud-trace, and most google/cloud-* SDKs. No architectural decision is actually being made here; it arrives with the SDK.google.rpc.Status-shaped error payloads from your own API, hand-building LogEntry structures, or generating your own protobuf clients for a gRPC service.Net: the package is plumbing. Its architectural value is standardization — one canonical shape for status/error/audit payloads across services — not capability. Do not position it as a feature enabler in a roadmap.
Integration feasibility
Composer-only, no service provider, no config, no facade. composer require google/cloud-common-protos:^1.0. Two real constraints:
google/protobuf v5 constraint. v1.0.0 exists specifically because the dependency was bumped to protobuf v5 (see the v1.0.0 breaking-change note). Anything else in the tree pinned to protobuf ^3/^4 will block the upgrade.google/protobuf PHP runtime works in pure PHP; ext-protobuf is an optional accelerator (materially faster, but not required). This is worth explicitly correcting in any internal write-up — requiring a C extension at the platform level is a much bigger ask than accepting a Composer package, and it is not actually required.gRPC (grpc/grpc, ext-grpc) is only in scope if you are calling gRPC transports or running a gRPC server. REST/JSON via the standard SDKs does not need it.
Technical risk
| Area | Severity | Notes / Mitigation |
|---|---|---|
| Protobuf major-version conflicts | High | v1.0.0 requires protobuf v5. Audit with composer why google/protobuf before upgrading anything. |
| Package-name confusion | Medium | Three related artifacts exist in the ecosystem (google/cloud-common-protos, google/common-protos, and the broader googleapis generated set). Standardize on one; document it. |
| JSON serialization assumptions | Medium | Protobuf JSON mapping ≠ plain json_encode: int64 renders as string, field names are camelCase, well-known types have special encodings. Laravel JsonResource/toArray() paths will leak wrong shapes. Needs explicit serializers + contract tests. |
| Immutability vs Eloquent | Medium | Requires mappers; budget for it only if you go direct. |
| Release-note quality | Medium | Recent releases are titled "Miscellaneous Chores," and v1.0.0's notes contain a literal merge-conflict marker. Treat changelogs as unreliable; verify via composer update --dry-run + diff. |
| Repo health signals | Low (but visible) | 3 stars / 0 direct dependents looks alarming in a scan; it is expected for a leaf dependency of a monorepo. Re-frame for stakeholders so it isn't misread as abandonment. |
| Schema drift vs live GCP APIs | Low–Medium | Google APIs add fields; strictly additive and wire-compatible, but a pinned package can lag newly documented fields. |
Key questions
ext-grpc enters the platform baseline.ext-protobuf acceptable in our build/runtime images, or do we standardize on pure PHP? This is a platform-team decision with a clear performance trade-off.google/common-protos (pre-split)? If so, who owns rationalizing to a single artifact?Stack fit
Fits Laravel 10/11 on PHP 8.1+ with Composer 2 without friction. It is a library of plain classes: register clients in the container as singletons, but never wrap protobuf messages in the container or in config. Keep them at the edges — request/response boundaries, log formatters, queue payload serializers, and outbound GCP calls.
Migration path
composer show -t and composer why google/cloud-common-protos (and google/common-protos) to confirm whether it is already present. In most Laravel apps it is, via a GCP SDK.common-protos and cloud-common-protos are present, converge on one in a dedicated PR — not bundled with a feature branch.Compatibility
google/protobuf explicitly (e.g. ^5.0) rather than relying on transitive resolution, and pin the common-protos version in composer.lock as you would any generated-code artifact.Sequencing
composer.json (^1.0 + google/protobuf).ext-protobuf / ext-grpc, applied to CI and runtime images.Maintenance
Near-zero at the application level: no runtime process, no migrations, no config, no cron. Maintenance cost is entirely dependency surface — regenerated code arriving through routine Composer updates. The practical obligation is a controlled update cadence (monthly or SDK-driven), not ongoing engineering.
Support
Upstream support is routed to the googleapis/google-cloud-php monorepo, not this repository; the README says so explicitly. Licensing is Apache-2.0, AS-IS. Google Cloud support plans cover SDK usage, not this artifact individually. Practically: your own team owns breakage, so keep the blast radius small by keeping usage at the edges.
Scaling
Generated classes are static and cheap; the scaling variable is serialization cost. Pure-PHP protobuf is roughly an order of magnitude slower than ext-protobuf — irrelevant for a few thousand messages a minute, relevant for high-volume log enrichment or per-request structured logging at scale. Second-order concern: log/storage amplification if you attach full protobuf-encoded payloads to every entry.
Failure modes
ext-protobuf is pinned in the image.google/common-protos alongside cloud-common-protos, producing duplicate classes and autoload ambiguity.Ramp-up
Low for consumption through SDKs — most engineers never touch the types directly. Moderate for anyone writing raw message construction or JSON serialization: budget roughly 1–2 days for a Laravel developer to be productive, and about a sprint of focused work (plus external expertise or training) before a team can confidently own a gRPC contract or an error-envelope standard. The ramp-up cost is really protobuf literacy, not this package. If the team cannot absorb that, stay on REST SDKs and treat this purely as a pinned transitive dependency — which, for the large majority of Laravel products, is the correct TPM recommendation.
How can I help you explore Laravel packages today?