PHPackages                             gluedev/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. gluedev/laravel-stackdriver

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

gluedev/laravel-stackdriver
===========================

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

0.2.2(6y ago)4765.7k26[3 issues](https://github.com/GlueDev/laravel-stackdriver/issues)[1 PRs](https://github.com/GlueDev/laravel-stackdriver/pulls)MITPHPPHP &gt;=7.1CI failing

Since Nov 28Pushed 1y ago6 watchersCompare

[ Source](https://github.com/GlueDev/laravel-stackdriver)[ Packagist](https://packagist.org/packages/gluedev/laravel-stackdriver)[ Docs](https://github.com/gluedev/laravel-stackdriver)[ RSS](/packages/gluedev-laravel-stackdriver/feed)WikiDiscussions develop Synced 3w ago

READMEChangelog (1)Dependencies (9)Versions (8)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

39

—

LowBetter than 85% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~100 days

Recently: every ~125 days

Total

6

Last Release

2261d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f57901a1cefc8c732c8abfb868afd441575e712f1a92586c6f658a3ee87a01b?d=identicon)[gluedev](/maintainers/gluedev)

---

Top Contributors

[![DiederikvandenB](https://avatars.githubusercontent.com/u/6132723?v=4)](https://github.com/DiederikvandenB "DiederikvandenB (7 commits)")[![ni-bschmitt](https://avatars.githubusercontent.com/u/58559970?v=4)](https://github.com/ni-bschmitt "ni-bschmitt (2 commits)")[![jangidgirish](https://avatars.githubusercontent.com/u/4018017?v=4)](https://github.com/jangidgirish "jangidgirish (1 commits)")[![sebastianmulders](https://avatars.githubusercontent.com/u/3605090?v=4)](https://github.com/sebastianmulders "sebastianmulders (1 commits)")[![Sija](https://avatars.githubusercontent.com/u/988?v=4)](https://github.com/Sija "Sija (1 commits)")[![deer-wmde](https://avatars.githubusercontent.com/u/91744937?v=4)](https://github.com/deer-wmde "deer-wmde (1 commits)")[![svenjens](https://avatars.githubusercontent.com/u/4559966?v=4)](https://github.com/svenjens "svenjens (1 commits)")[![ibrunotome](https://avatars.githubusercontent.com/u/4256471?v=4)](https://github.com/ibrunotome "ibrunotome (1 commits)")

---

Tags

error-reportinggoogle-cloudlaravelloggingstackdrivertracinglaravelloggingerror-reportinggoogletracingstackdriver

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k122.6M185](/packages/sentry-sentry-laravel)

PHPackages © 2026

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