PHPackages                             oilytortoise/laravel-telemetry - 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. oilytortoise/laravel-telemetry

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

oilytortoise/laravel-telemetry
==============================

A simple package for integrating a Laravel application with BetterStack's Telemetry service.

v1.4.2(8mo ago)0363↓50%MITPHPPHP ^8.0

Since Dec 6Pushed 8mo ago1 watchersCompare

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

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

laravel-telemetry
=================

[](#laravel-telemetry)

Integration between Laravel and Betterstack's Telemetry feature (for logging and metrics)
BetterStack: \[\]

Basically, the documentation for setting up Telemetry with laravel recommends a method that requires instantiating and setting up the logger object every time you want to log something which, imo, is combersome and not very performant.

This package does not exclusively log to Telemetry. If the `ENABLE_TELEMETRY` environment variable is set to `false` the package will return to logging to the default Laravel log channel as configured in your `logging.php` config file.
This package is built to make the logging process much simpler and implement some other handy logging / debugging features.

Installation
============

[](#installation)

```
composer require oilytortoise/laravel-telemetry

```

Setup BetterStack
=================

[](#setup-betterstack)

1. Sign up for betterstack
2. Go to the "Telemetry" tab
3. Navigate to "Sources" and create a new source for a PHP app

Setup Laravel Application
=========================

[](#setup-laravel-application)

*This is a recommended setup - feel free to use the package however you like!*

1. publish the package's config file:

```
php artisan vendor:publish --tag=telemetry-config

```

2. In your `AppServiceProvider` add the following in the `boot()` function to create a singleton you can utilize throughout your application whenever you want to log an event:

```
use Oilytortoise\LaravelTelemetry\TelemetryLogger;
.
.
.
public function boot()
{
    $this->app->singleton('telemetry', function ($app) {
        return new TelemetryLogger();
    });
}

```

*note: The benefit of using a singleton is that your application will load the class only once when it is booted, then you can use that instance of the telemetry logger service instead of creating a new instance every time you want to log something. This reduces the development effort and makes the process more performant.*

You may tag the singleton however you want. I use `'telemetry'` in the example above but you could use `'log'`, or `'TelemetryLogger::class'` or anything you want as long as it doesn't clash with another singleton in the app.

3. In your `.env` file, add the following:

```
TELEMETRY_ENABLED=true
TELEMETRY_SOURCE_TOKEN=

```

4. To log an event you can use the logger as shown below:

```
app('telemetry')->info('Example log event', ['context_field' => 'example context value']);

```

The syntax for logging is essentially the same as the default `\Illuminate\Support\Facades\Log` service provided by Laravel. The same `debug`, `info`, `notice`, `warning`, `error`, `critical`, `alert`, `emergency` functions act as the log level. The first parameter passed in is the log message, the second parameter is the context array.

5. To log exceptions to telemetry, there are two options:
    To report all exceptions EXCEPT for the ones in your configured `exception_blacklist`, add the following to the `register()` function in your `App\Exceptions\Handler` class:

```
if (! app('telemetry')->shouldIgnore($e)) {
    app('telemetry')->error($e->getMessage()); // or however you'd like to log the errors.
}

```

To report only the exceptions that appear in your configured `exception\_whitelist`: ``` if (! app('telemetry')-&gt;shouldReport($e)) { app('telemetry')-&gt;error($e-&gt;getMessage()); // or however you'd like to log the errors. } ```
The choice is yours whether you want to report all exceptions except for the ones blacklisted in the `telemetry.php` config file, or only report the exceptions whitelisted in the config file. Features
========

[](#features)

There are a few extended features included in this package:

Default Context
---------------

[](#default-context)

By default, whenever you log an event, the package will always include the app environment, and the authorized user ID in the context field. If there is no active user session (for example during a scheduled job or some third party webhook request) the user ID will be set to "system".

Debug Context
-------------

[](#debug-context)

Whenever you make a debug log, the package will automatically add a "class::function" context field, the value of which will tell you the class and function the log was sent from. This can be helpful when you are attempting to debug an issue in a live environment and you don't know where the bug is occuring.

Enable Switch
-------------

[](#enable-switch)

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance59

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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 ~43 days

Recently: every ~65 days

Total

7

Last Release

260d ago

PHP version history (2 changes)v1.0PHP ^8.3.6

v1.4.1PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![oilytortoise](https://avatars.githubusercontent.com/u/152834130?v=4)](https://github.com/oilytortoise "oilytortoise (1 commits)")

### Embed Badge

![Health badge](/badges/oilytortoise-laravel-telemetry/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)

PHPackages © 2026

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