google/cloud-logging
Stackdriver Logging Client for PHP
Maintainers
Requires
- php: ^8.1
- google/cloud-core: ^1.66
- google/gax: ^1.38.0
Requires (Dev)
- dg/bypass-finals: ^1.9
- erusev/parsedown: ^1.6
- fig/log-test: ^1.1
- google/cloud-bigquery: ^1.0
- google/cloud-pubsub: ^2.0
- google/cloud-storage: ^2.0
- monolog/monolog: ^3.8
- nikic/php-parser: ^5.0
- opis/closure: ^3
- phpdocumentor/reflection: ^5.3.3||^6.0
- phpdocumentor/reflection-docblock: ^5.3.3||^6.0
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: 2.*
Suggests
- ext-grpc: The gRPC extension enables use of the performant gRPC transport
- ext-protobuf: Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.
- psr/log: For using the PSR logger. Currently supports versions 1 and 2.
Provides
- psr/log-implementation: 2.0||3.0
Conflicts
None
Replaces
None
Apache-2.0 8490eabc9d99a4b10af2d87d160c9dd0492c689e
This package is auto-updated.
Last update: 2026-06-12 21:23:16 UTC
README
Idiomatic PHP client for Stackdriver Logging.
👁 Latest Stable Version
👁 Packagist
NOTE: This repository is part of Google Cloud PHP. Any support requests, bug reports, or development contributions should be directed to that project.
Allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.
Installation
To begin, install the preferred dependency manager for PHP, Composer.
Now install this component:
$ composer require google/cloud-logging
This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods) please see our gRPC installation guide.
Authentication
Please see our Authentication guide for more information on authenticating your client. Once authenticated, you'll be ready to start making requests.
Sample
use Google\ApiCore\ApiException; use Google\Cloud\Logging\V2\Client\ConfigServiceV2Client; use Google\Cloud\Logging\V2\GetBucketRequest; use Google\Cloud\Logging\V2\LogBucket; // Create a client. $configServiceV2Client = new ConfigServiceV2Client(); // Prepare the request message. $request = (new GetBucketRequest()) ->setName($formattedName); // Call the API and handle any network failures. try { /** @var LogBucket $response */ $response = $configServiceV2Client->getBucket($request); printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); }
Debugging
Please see our Debugging guide for more information about the debugging tools.
Version
This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in any minor or patch releases. We will address issues and requests with the highest priority.
Next Steps
- Understand the official documentation.
- Take a look at in-depth usage samples.
