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

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

tylerr92/laravel-stackdriver
============================

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

2.0.5(5y ago)04.7kMITPHPPHP &gt;=7.3

Since Nov 28Pushed 5y agoCompare

[ Source](https://github.com/tylerr92/laravel-stackdriver)[ Packagist](https://packagist.org/packages/tylerr92/laravel-stackdriver)[ Docs](https://github.com/tylerr92/laravel-stackdriver)[ RSS](/packages/tylerr92-laravel-stackdriver/feed)WikiDiscussions develop Synced today

READMEChangelog (7)Dependencies (9)Versions (12)Used By (0)

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

[](#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 tylerr92/laravel-stackdriver
```

And publish the config file

```
php artisan vendor:publish --provider="tylerr92\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.

I suggest you configure the following ENVs in your .env file

```
STACKDRIVER_LOGNAME="error-log"
STACKDRIVER_ENABLED="true"
STACKDRIVER_LOGGING_ENABLED="true"
STACKDRIVER_TRACING_ENABLED="true"
STACKDRIVER_ERROR_REPORTING_ENABLED="true"
STACKDRIVER_KEY_FILE_PATH="path/to/key/file.json"
GOOGLE_CLOUD_PROJECT"project-id-14555"
IS_BATCH_DAEMON_RUNNING="true"
```

### 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 tylerr92\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)

- Maintained By \[Tyler Radlick\]
- Forked from \[Diederik van den Burger (GlueDev)\]
- \[All Contributors\]\[link-contributors\]

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community3

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~89 days

Recently: every ~174 days

Total

10

Last Release

1920d ago

Major Versions

0.1.6 → 1.0.02019-08-12

1.0.0 → 2.0.02021-02-05

PHP version history (2 changes)v0.1.0PHP &gt;=7.1

2.0.5PHP &gt;=7.3

### Community

Maintainers

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

---

Top Contributors

[![tylerr92](https://avatars.githubusercontent.com/u/25037963?v=4)](https://github.com/tylerr92 "tylerr92 (11 commits)")

---

Tags

laravelloggingerror-reportinggoogletracingstackdriver

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[gluedev/laravel-stackdriver

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

4865.6k](/packages/gluedev-laravel-stackdriver)[sentry/sentry-laravel

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

1.3k114.3M154](/packages/sentry-sentry-laravel)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[codeinternetapplications/monolog-stackdriver

Stackdriver handler for Monolog.

14181.7k](/packages/codeinternetapplications-monolog-stackdriver)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

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