PHPackages                             phattarachai/watchtower-laravel - 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. phattarachai/watchtower-laravel

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

phattarachai/watchtower-laravel
===============================

Laravel client for the Watchtower self-hosted Sentry-compatible exception tracker. Wires up sentry/sentry-laravel and a same-origin browser tunnel that dodges ad blockers.

v0.4.4(3w ago)064↑100%MITPHPPHP ^8.4

Since May 17Pushed 1w agoCompare

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

READMEChangelogDependencies (9)Versions (9)Used By (0)

Watchtower Laravel
==================

[](#watchtower-laravel)

Laravel client for [Watchtower](https://github.com/phattarachai/watchtower), a self-hosted Sentry-compatible exception tracker. Installs and configures `sentry/sentry-laravel`, wires `Integration::handles($exceptions)` into `bootstrap/app.php`, and exposes a same-origin browser tunnel (`/api/watchtower-relay`) that proxies envelopes to your Watchtower instance — dodging ad-blockers that strip `?sentry_key=` query strings.

Install
-------

[](#install)

```
composer require phattarachai/watchtower-laravel
php artisan watchtower:install --dsn=http://your-public-key@your-watchtower-host/42
```

The install command:

1. Validates and writes `WATCHTOWER_DSN` and `SENTRY_LARAVEL_DSN` to `.env`.
2. Patches `bootstrap/app.php` to call `Sentry\Laravel\Integration::handles($exceptions)` inside `withExceptions(...)`.
3. Publishes `config/watchtower.php`.
4. If `vite.config.{js,ts}` is present, writes `VITE_SENTRY_DSN`, `VITE_SENTRY_TUNNEL`, and `VITE_SENTRY_ENVIRONMENT` and prints a Vite entry snippet.
5. If the `claude` (Claude Code) CLI is on PATH, registers the Watchtower MCP server so Claude can query and triage issues directly. Pass `--no-mcp` to skip.

Re-running is idempotent. Pass `--dry-run` to preview changes.

Configuration
-------------

[](#configuration)

Env keyDefaultPurpose`WATCHTOWER_DSN`falls back to `SENTRY_LARAVEL_DSN`Watchtower DSN: `http://{key}@{host}/{numeric-project-id}`.`WATCHTOWER_RELAY_ENABLED``true`Register the relay route on boot.`WATCHTOWER_RELAY_PATH``/api/watchtower-relay`Relay endpoint path (must live under `/api/`).`WATCHTOWER_RELAY_TIMEOUT``5`Upstream request timeout (seconds).`WATCHTOWER_RELAY_ASYNC``false`Forward envelopes through a queued job instead of sync.`WATCHTOWER_RELAY_QUEUE`*(default queue)*Queue name when async is enabled.`WATCHTOWER_VERIFY_SSL``true`Verify upstream TLS certificate.`WATCHTOWER_CONNECT_TIMEOUT``3`Guzzle connect timeout (seconds).Browser side
------------

[](#browser-side)

The browser SDK posts envelopes to your own app at `/api/watchtower-relay`. The relay parses your configured DSN, forwards the request body verbatim to `{scheme}://{host_with_port}/api/watchtower-relay` on the Watchtower instance, and passes back the upstream status and rate-limit headers.

`watchtower:install` publishes a small helper to `resources/js/vendor/watchtower.js` that wraps `Sentry.init(...)` with the Watchtower-tuned defaults (same-origin tunnel, no PII, browser-extension `denyUrls`) and applies `` to `Sentry.setUser(...)`. Per Vite entry:

```
import { initWatchtower } from './vendor/watchtower.js';

initWatchtower();
```

The Sentry config lives inside the published helper, so multiple entries don't duplicate it. Customize options (e.g. `ignoreErrors`) there once.

In your root Blade layout's `` add the package directive that emits the user-context meta tags:

```
@watchtowerUser
```

`@watchtowerUser` is registered automatically by the service provider and compiles to three `` tags. Customize by publishing the view: `php artisan vendor:publish --tag=watchtower-views`.

For Filament admin panels (which bypass the root Blade layout), register a render hook:

```
$panel->renderHook(
    PanelsRenderHook::HEAD_END,
    fn (): string => Blade::render('@watchtowerUser'),
);
```

Because the request hits your own origin under `/api/`, ad-blockers don't recognize it as Sentry traffic.

Async forwarding
----------------

[](#async-forwarding)

Set `WATCHTOWER_RELAY_ASYNC=true` to dispatch each forward through a `ForwardEnvelope` job. The relay returns `202 {"queued": true}` immediately and the worker performs the upstream POST. Failures are logged but not retried beyond Guzzle's default behavior — the Sentry SDK retransmits anyway.

Verify
------

[](#verify)

```
php artisan watchtower:test
```

Prints the resolved config, runs `sentry:test`, and POSTs a synthetic envelope through the relay path.

Troubleshooting
---------------

[](#troubleshooting)

The bundled skill at `vendor/phattarachai/watchtower-laravel/resources/boost/skills/watchtower-error-tracking/reference.md` covers every install + verify + triage path, including the MCP server. To install it into Claude's skill set: `php artisan boost:install --skills`.

License
-------

[](#license)

MIT.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance97

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Total

8

Last Release

22d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62843288?v=4)[phatchai](/maintainers/phatchai)[@phatchai](https://github.com/phatchai)

---

Top Contributors

[![phattarachai](https://avatars.githubusercontent.com/u/2162876?v=4)](https://github.com/phattarachai "phattarachai (20 commits)")

---

Tags

laravelsentryobservabilityerror-trackingexception trackingwatchtower

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/phattarachai-watchtower-laravel/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76318.2M110](/packages/laravel-mcp)[spatie/laravel-export

Create a static site bundle from a Laravel app

670139.5k6](/packages/spatie-laravel-export)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)

PHPackages © 2026

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