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

Cloud Logging Laravel Package

google/cloud-logging

Idiomatic PHP client for Google Cloud Logging (formerly Stackdriver) to store, search, analyze, monitor, and alert on log data from Google Cloud and AWS. Install via Composer; supports REST and gRPC.

View on GitHub
Deep Wiki
Context7

google/cloud-logging is the idiomatic PHP client for Stackdriver Logging (Google Cloud Logging), letting you store, search, analyze, monitor, and alert on log data from Google Cloud Platform and AWS. It's part of the Google Cloud PHP family and supports both REST over HTTP/1.1 and gRPC, including streaming methods for high-throughput workloads.

Install it with composer require google/cloud-logging, authenticate via the official guide, and use the generated V2 clients to manage buckets and read or write log entries.

  • Full API coverage — logging, sinks, metrics, and bucket management
  • gRPC or REST transports with streaming support
  • Generated V2 clients like ConfigServiceV2Client
  • Typed request/response messages with JSON serialization
  • GA stability with documented authentication and debugging
Frequently asked questions about Cloud Logging
How do I install google/cloud-logging in a Laravel app?
Install it with composer require google/cloud-logging. In Laravel, bind Google\Cloud\Logging\V2\LoggingClient as a singleton or wrap it in a service provider, then configure Google Cloud credentials. You can also add a Monolog handler to forward Laravel logs.
Does google/cloud-logging work with Laravel's Monolog logging?
Yes. You can create a custom Monolog handler that sends records through google/cloud-logging, or extend Laravel's logging stack with a Cloud Logging channel. The client supports structured JSON payloads and severity levels, which map well to PSR-3 and Laravel log levels.
How do I authenticate google/cloud-logging in Laravel?
On Google Cloud, use Application Default Credentials so the runtime service account supplies credentials. Outside GCP, provide a service account key through environment variables or Laravel's config and never hardcode it. The Google Auth library handles token acquisition.
Should I use gRPC or REST with google/cloud-logging?
REST works without extra PHP extensions and is fine for lower-volume logging. gRPC requires the grpc PHP extension but can be better for streaming and batching in high-throughput services. Test cold-start and runtime behavior if you deploy to Cloud Run.
What PHP and Laravel versions does google/cloud-logging support?
The package is framework-agnostic; Laravel support comes from wrapping it in a service provider, facade, or Monolog handler. Officially check the Composer constraints for PHP support, as the component targets PHP 8.4+ with older versions possible via compatibility fixes. Use a maintained Laravel version that satisfies those constraints.
How do I handle errors and retries when writing logs to Google Cloud Logging?
Catch Google\ApiCore\ApiException around writes and add retries with exponential backoff for rate limits or transient failures. Keep payloads under Cloud Logging entry limits and truncate or batch large context. Consider a local fallback handler if the API is unavailable.
Is google/cloud-logging expensive for Laravel production apps?
The Composer package is free, but Cloud Logging charges based on ingestion, storage, and query usage. High-volume Laravel apps should monitor log volume and use exclusions or exports to control cost. Review pricing tiers and BigQuery export costs before production.
What are alternatives to google/cloud-logging for Laravel logging?
Alternatives include Laravel's file and stack channels, Papertrail, Datadog, Elasticsearch, or other cloud logging services. Choose google/cloud-logging when you are already on Google Cloud and want native Cloud Logging, Monitoring, and Error Reporting integration. For multi-cloud or AWS-heavy setups, evaluate vendor lock-in.
Is google/cloud-logging GA and maintained, and what changed in v2?
google/cloud-logging is GA and part of the maintained Google Cloud PHP monorepo. Minor releases should not introduce backwards-incompatible changes, but v2 introduced API changes such as LogSeverity formatting, so test migrations from v1. Review release notes before upgrading.
How do I test google/cloud-logging locally without sending logs to Google Cloud?
In tests, avoid sending real logs by binding a fake or mock LoggingClient in Laravel's container or swapping the Monolog handler. Use local file logging for most feature tests and reserve real Cloud Logging integration tests for a dedicated GCP project. Keep credentials out of test code.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings