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 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

Product Decisions This Supports

  • Standardization of Data Contracts: Enables Laravel applications to adopt Google Cloud’s protobuf schemas (e.g., 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.
  • Build vs. Buy Decision for Google Cloud SDKs: Justifies leveraging Google Cloud PHP SDKs (e.g., 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.
  • Future-Proofing for Schema Evolution: Aligns with Google’s long-term API strategy by providing backward-compatible protobuf types (e.g., PermissionType, OperationMetadata). Mitigates migration costs when Google updates schemas (e.g., deprecating ReservationResourceUsage).
  • Key Use Cases:
    • Audit & Compliance: Structuring log entries for Google Cloud Audit Logs to meet regulatory requirements (e.g., SOC 2, GDPR) or enhance security monitoring in Laravel.
    • gRPC Microservices: Building high-performance internal tools in Laravel with strict protobuf compliance (e.g., custom audit routing, event-driven workflows, or real-time data pipelines).
    • Error Standardization: Aligning API error responses with Google’s Google\Rpc\Status format for consistency with GCP services and improved debugging.
    • Metadata Enrichment: Augmenting Laravel logs with HTTP request metadata via Google\Logging\Type\HttpRequest for observability (e.g., tracing, analytics).
    • Laravel Package Ecosystem: Creating reusable packages (e.g., laravel-google-cloud) that interact with Google Cloud APIs and require shared protobuf schemas for consistency.

When to Consider This Package

Adopt When:

  • Building gRPC Services: Developing high-performance internal tools in Laravel where HTTP APIs are insufficient (e.g., real-time data processing, microservices, or event-driven architectures).
  • Deep Google Cloud Integrations: Working with protobuf-heavy GCP services (e.g., Cloud Logging, Pub/Sub, IAM) and needing fine-grained control over serialization/deserialization.
  • Leveraging Official SDKs: Using Google Cloud PHP SDKs (e.g., google/cloud-storage, google/cloud-logging) and extending their protobuf-based functionality without reinventing the wheel.
  • Protobuf Expertise Available: Your team has experience with protobuf/gRPC and can manage extension dependencies (google/protobuf) and immutable DTO patterns in Laravel.
  • Long-Term Maintainability: Prioritizing officially supported dependencies over custom implementations to reduce technical debt and align with Google’s API evolution.
  • Laravel Package Development: Creating reusable packages that interact with Google Cloud APIs and require shared protobuf schemas for consistency (e.g., a monorepo like laravel-google-cloud).

Avoid When:

  • REST-First Applications: Your Laravel app relies on standard REST APIs (prefer Laravel’s HTTP client, Guzzle, or official REST SDKs for simplicity).
  • Lack of Protobuf/gRPC Knowledge: Your team lacks expertise in protobuf schemas or gRPC, making maintenance and debugging challenging.
  • Extension Dependency Risks: Your deployment environment cannot support PHP extensions (e.g., google/protobuf), complicating CI/CD or production setups.
  • No Google Cloud Protobuf Needs: You’re not using Google Cloud services requiring protobuf payloads (e.g., Audit Logs, IAM policies) and only need basic HTTP integrations.
  • Public-Facing APIs: Building a JSON/REST-based API where protobuf’s binary format adds unnecessary complexity and client-side compatibility issues.
  • Zero Dependents Risk: The package’s lack of direct dependents (0) and high technical risk (e.g., version conflicts, extension requirements) may not justify adoption for lightweight use cases.

How to Pitch It (Stakeholders)

For Executives/Stakeholders:

*"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:

  • Standardization: Ensures consistency with Google’s API contracts, reducing errors in data exchange.
  • Future-Proofing: Aligns with Google’s long-term schema evolution (e.g., PermissionType, OperationMetadata).
  • Risk Reduction: Uses officially supported dependencies, avoiding reinvention and compatibility issues.
  • Minimal Overhead: For most use cases, the SDKs that include this package will handle everything automatically—no additional effort required.

Trade-offs:

  • Requires PHP extensions (google/protobuf), which may add deployment complexity.
  • Best suited for gRPC services or deep GCP integrations; not ideal for REST-only applications.

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."*


For Engineering/Dev Teams:

*"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):

  • Install Google Cloud PHP SDKs (e.g., composer require google/cloud-logging) to automatically include google/cloud-common-protos as a dependency. This is the simplest path for most use cases.
  • Example: Use Google\Cloud\Logging\LoggingClient for structured logging, which internally relies on protobuf schemas from this package.

2. Direct Adoption (For Custom Protobuf Needs):

  • Add to composer.json:
    "google/cloud-common-protos": "^1.0"
    
  • Use generated classes (e.g., Google\Protobuf\Internal\Message) to build custom protobuf payloads for gRPC services or advanced integrations.
  • Example: Extend Google\Logging\Type\LogEntry to add custom metadata fields while maintaining compatibility with Google’s schema.

3. Integration with Laravel:

  • Service Providers: Register protobuf-based clients in Laravel’s service container:
    $this->app->singleton(LoggingClient::class, function ($app) {
        return new LoggingClient(['keyFilePath' => $app['config']['google.cloud.key']]);
    });
    
  • DTOs: Map protobuf messages to Laravel Eloquent models or DTOs for consistency:
    $logEntry = (new LogEntry())
        ->setTimestamp(new \Google\Type\Timestamp())
        ->setSeverity('INFO');
    
  • Observability: Use Google\Logging\Type\HttpRequest to enrich Laravel logs with HTTP metadata:
    $request = (new HttpRequest())
        ->setRequestUrl('https://api.example.com')
        ->setRequestMethod('GET');
    

Key Considerations:

  • Extensions: Ensure your environment supports google/protobuf (PHP extensions). Test with:
    composer require google/protobuf
    
  • Schema Evolution: Monitor Google’s protobuf updates (e.g., PermissionType changes) to avoid breaking changes. Use semantic versioning (^1.0) for stability.
  • Debugging: Leverage protobuf’s built-in validation (e.g., isInitialized()) to catch malformed payloads early.
  • Alternatives: For REST-only workflows, consider google/cloud-core or custom JSON serialization instead.

Example Workflow (Audit Logs):

  1. Install SDK:
    composer require google/cloud-logging
    
  2. Log structured data:
    $client = new LoggingClient();
    $entry = (new LogEntry())
        ->setLogName('projects/my-project/logs/audit')
        ->setSeverity('INFO')
        ->setJsonPayload(json_encode(['user_id' => 123]));
    $client->entries()->write($entry);
    
  3. Parse incoming protobuf logs:
    $entries = $client->entries()->listEntries('projects/my-project/logs/audit');
    foreach ($entries as $entry) {
        $payload = json_decode($entry->getJsonPayload(), true);
        // Process payload...
    }
    ```"
    
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport