Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Cloud Common Protos

Cloud Common Protos Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Common Protos for Google Cloud APIs

Frequently asked questions about Cloud Common Protos
Do I need to install `google/cloud-common-protos` directly in my Laravel app, or is it included via Google Cloud SDKs?
You rarely need to install it directly—most Google Cloud PHP SDKs (e.g., `google/cloud-logging`) include it as a dependency. Only install it explicitly if you’re building custom protobuf-based services or need shared proto types without full SDKs.
What Laravel versions support `google/cloud-common-protos`?
The package itself has no Laravel-specific dependencies, but it requires PHP 8.1+ and the `google/protobuf` extension. Laravel 9+ is recommended for compatibility with modern PHP features used in Google Cloud SDKs.
How do I handle protobuf immutability in Laravel’s Eloquent models?
Protobuf objects are immutable, which conflicts with Eloquent’s mutable patterns. Use DTO mappers (e.g., `spatie/laravel-data`) to convert between protobuf objects and Eloquent models, or create adapters to bridge the two.
Will this package work with Laravel’s service container?
Yes, you can bind protobuf classes as Laravel service container singletons or resolve them dynamically. However, their immutability may require custom logic for dependency injection compared to traditional Laravel services.
How do I serialize protobuf objects for JSON API responses in Laravel?
Protobuf objects aren’t JSON-serializable by default. Use `$protobuf->serializeToJsonString()` or implement a custom serializer in your API responses. For requests, deserialize with `$protobuf->parseFromString($json).
What are the deployment risks of the `google/protobuf` extension?
The extension requires PHP compiled with protobuf support. Test your CI/CD (Docker/Kubernetes) or shared hosting environment early. If unavailable, consider pure-PHP alternatives like `prooph/pds`, though they lack Google Cloud compatibility.
How do I handle deprecated protobuf fields (e.g., `ReservationResourceUsage`) in Laravel?
Google’s protobuf schemas are backward-compatible, but deprecated fields may trigger warnings. Use feature flags or middleware to suppress warnings, or gradually phase out deprecated fields in your application logic.
Can I use this package with Laravel’s API resources for structured responses?
Yes, but you’ll need to customize API resources to serialize protobuf objects. Extend Laravel’s `JsonResource` or use a custom serializer to convert protobuf data into JSON-compatible arrays before rendering.
What alternatives exist if I don’t want to use protobufs in Laravel?
For Google Cloud APIs, alternatives include REST-based SDKs (e.g., `guzzlehttp/guzzle` for raw HTTP calls) or pure-PHP data structures. However, protobufs offer better performance and schema validation for gRPC or high-volume APIs.
How do I test Laravel applications using `google/cloud-common-protos`?
Mock protobuf objects in tests using PHPUnit’s mocking or create test doubles for dependencies. For integration tests, use in-memory protobuf serialization or mock the `google/protobuf` extension with libraries like `php-mock-extension`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-actions
aimeos/prisma
besmartand-pro/php-quality-config
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor