PHPackages                             kalahroudi/laravel-stackdriver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. kalahroudi/laravel-stackdriver

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

kalahroudi/laravel-stackdriver
==============================

Enables logging, tracing and error reporting to Google Stackdriver for the Laravel framework

01PHP

Since Apr 14Pushed 3y agoCompare

[ Source](https://github.com/kalahroudi/laravel-stackdriver)[ Packagist](https://packagist.org/packages/kalahroudi/laravel-stackdriver)[ RSS](/packages/kalahroudi-laravel-stackdriver/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Stackdriver
===================

[](#laravel-stackdriver)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6f848fff920eff132d63fccf7d809bd304d22ee751cb59be8250b1f38f6fbb4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676c75656465762f6c61726176656c2d737461636b6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gluedev/laravel-stackdriver)[![Total Downloads](https://camo.githubusercontent.com/78f96151fb19e97b955583979f3c5df01c9f3873b7233a8e3593da879354dc6d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676c75656465762f6c61726176656c2d737461636b6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gluedev/laravel-stackdriver)

Enables logging, tracing and error reporting to Google Stackdriver for Laravel. Requires PHP &gt;= 7.1

Screenshots
-----------

[](#screenshots)

[![Tracing](storage/screenshots/screenshot_1.png)](storage/screenshots/screenshot_1.png) [![Error reporting](storage/screenshots/screenshot_2.png)](storage/screenshots/screenshot_2.png)

Installation
------------

[](#installation)

Via Composer

```
composer require gluedev/laravel-stackdriver
```

And publish the config file

```
php artisan vendor:publish --provider="GlueDev\Laravel\Stackdriver\StackdriverServiceProvider"
```

Usage
-----

[](#usage)

First, you will want to open `config/stackdriver.php`. Here you can see that you have four environment settings available to enable and disable the different features of this package:

```
STACKDRIVER_ENABLED=false
STACKDRIVER_LOGGING_ENABLED=true
STACKDRIVER_TRACING_ENABLED=true
STACKDRIVER_ERROR_REPORTING_ENABLED=true
```

The first variable listed has priority over the others.

### Authentication

[](#authentication)

At the time of writing, Google prefers you to authenticate using a service account. It will throw a warning otherwise, which you can (but probably should not) disable by setting `SUPPRESS_GCLOUD_CREDS_WARNING=true`

Create a service account with the appropriate roles attached to it and add it to your project. Make sure not to commit this file to git, because of security. You can then specify the path to the service account JSON file in the `keyFilePath` or in the `STACKDRIVER_KEY_FILE_PATH` environment variable.

### Tracing

[](#tracing)

Tracing requires the OpenCencus module to be installed. As we use docker, this is how we install it:

```
RUN pecl install opencensus-alpha
RUN docker-php-ext-enable opencensus
```

**Please note**: If you run in to an `opencensus.so: undefined symbol: ZVAL_DESTRUCTOR` error after installing the OpenCencus extension, it is recommended to build the extension yourself, following [these instructions](https://github.com/GlueDev/laravel-stackdriver/issues/6#issuecomment-584157568).

### Logging

[](#logging)

Other than changing the values in the config file, logging needs no additional setup.

### Error reporting

[](#error-reporting)

Error reporting requires you to add the following to the `report` function in your `Exceptions/handler.php`

```
use GlueDev\Laravel\Stackdriver\StackdriverExceptionHandler;

/**
 * Report or log an exception.
 *
 * @param \Exception  $exception
 * @return void
 */
public function report(Exception $exception)
{
    StackdriverExceptionHandler::report($exception);
    parent::report($exception);
}
```

Log in to Google Cloud Console and you should start seeing logs, traces and errors appear.

### Batch daemon

[](#batch-daemon)

Google also provides a batch daemon, which is recommended to use. We have seen issues with slow time to first byte on requests when the daemon was not running. The easiest way to run the daemon is using Supervisor. An example configuration for you to edit:

```
[program:google-batch-daemon]
command = php -d auto_prepend_file='' -d disable_functions='' /app/vendor/bin/google-cloud-batch daemon
process_name = %(program_name)s
user = application
numprocs = 1
autostart = true
autorestart = true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
```

You also need to tell Google that the daemon is running. This is done by setting the `IS_BATCH_DAEMON_RUNNING=true`.

And that is it!

Change log
----------

[](#change-log)

Please see the [changelog](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Diederik van den Burger](https://github.com/diederikvandenb)
- [All Contributors](../../contributors%5D)

License
-------

[](#license)

Please see the [license file](LICENSE.md) for more information.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d22249c0c9b129d1c48ba6fcf82eafcfa9d3280ed9c4811d6907fc77c5ffd492?d=identicon)[moram](/maintainers/moram)

---

Top Contributors

[![DiederikvandenB](https://avatars.githubusercontent.com/u/6132723?v=4)](https://github.com/DiederikvandenB "DiederikvandenB (7 commits)")[![kalahroudi](https://avatars.githubusercontent.com/u/64012378?v=4)](https://github.com/kalahroudi "kalahroudi (3 commits)")[![ni-bschmitt](https://avatars.githubusercontent.com/u/58559970?v=4)](https://github.com/ni-bschmitt "ni-bschmitt (2 commits)")[![ibrunotome](https://avatars.githubusercontent.com/u/4256471?v=4)](https://github.com/ibrunotome "ibrunotome (1 commits)")[![jangidgirish](https://avatars.githubusercontent.com/u/4018017?v=4)](https://github.com/jangidgirish "jangidgirish (1 commits)")

### Embed Badge

![Health badge](/badges/kalahroudi-laravel-stackdriver/health.svg)

```
[![Health](https://phpackages.com/badges/kalahroudi-laravel-stackdriver/health.svg)](https://phpackages.com/packages/kalahroudi-laravel-stackdriver)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.1k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M137](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
