PHPackages                             asbiin/laravel-sentry-tunnel - 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. [API Development](/categories/api)
4. /
5. asbiin/laravel-sentry-tunnel

ActiveLibrary[API Development](/categories/api)

asbiin/laravel-sentry-tunnel
============================

Provides an endpoint to use the `tunnel`-parameter of the Sentry SDK

2.4.0(3mo ago)245.4k↓40.3%2[1 issues](https://github.com/asbiin/laravel-sentry-tunnel/issues)MITPHPPHP ^8.2CI passing

Since Mar 17Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/asbiin/laravel-sentry-tunnel)[ Packagist](https://packagist.org/packages/asbiin/laravel-sentry-tunnel)[ GitHub Sponsors](https://github.com/asbiin)[ RSS](/packages/asbiin-laravel-sentry-tunnel/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (5)Dependencies (26)Versions (8)Used By (0)

Laravel Sentry Tunnel
=====================

[](#laravel-sentry-tunnel)

This package provides a URL for use with the [`tunnel`-option](https://docs.sentry.io/platforms/javascript/troubleshooting/#using-the-tunnel-option) of the Sentry SDK.

[![Latest Version](https://camo.githubusercontent.com/43d83f094f483a753c7e68d3a395ce8dc48317b32a86f09b159e7d0727c3cae8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61736269696e2f6c61726176656c2d73656e7472792d74756e6e656c3f7374796c653d666c61742d737175617265266c6162656c3d4c617465737425323056657273696f6e)](https://github.com/asbiin/laravel-sentry-tunnel/releases)[![Downloads](https://camo.githubusercontent.com/1844ac85fd441c2553c9471a19b3ce926efab3b4eb33f15156c13e793eea4839/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61736269696e2f6c61726176656c2d73656e7472792d74756e6e656c3f7374796c653d666c61742d737175617265266c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/asbiin/laravel-sentry-tunnel)[![Workflow Status](https://camo.githubusercontent.com/d35e41c904e77d257d3e0648ced41008c0cbd81cafabe623743b4e953798c7d8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61736269696e2f6c61726176656c2d73656e7472792d74756e6e656c2f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d576f726b666c6f77253230537461747573)](https://github.com/asbiin/laravel-sentry-tunnel/actions?query=branch%3Amain)[![Quality Gate](https://camo.githubusercontent.com/e07ea09dfb4b539e8c1e1cfeb3c02aba03df48d41324ad18db45767c13bf9f3b/68747470733a2f2f696d672e736869656c64732e696f2f736f6e61722f7175616c6974795f676174652f61736269696e5f6c61726176656c2d73656e7472792d74756e6e656c3f7365727665723d6874747073253341253246253246736f6e6172636c6f75642e696f267374796c653d666c61742d737175617265266c6162656c3d5175616c69747925323047617465)](https://sonarcloud.io/dashboard?id=asbiin_laravel-sentry-tunnel)[![Coverage Status](https://camo.githubusercontent.com/268afdbef242c7d5ab8e2b1af23ed63545a541ee806dfb70ea0f20289640265c/68747470733a2f2f696d672e736869656c64732e696f2f736f6e61722f636f7665726167652f61736269696e5f6c61726176656c2d73656e7472792d74756e6e656c3f7365727665723d6874747073253341253246253246736f6e6172636c6f75642e696f267374796c653d666c61742d737175617265266c6162656c3d436f766572616765253230537461747573)](https://sonarcloud.io/dashboard?id=asbiin_laravel-sentry-tunnel)

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

[](#installation)

```
composer require asbiin/laravel-sentry-tunnel
```

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

[](#configuration)

You can optionally publish the configuration files:

```
php artisan vendor:publish --provider=SentryTunnel\\Provider
```

### Allowed hosts and projects

[](#allowed-hosts-and-projects)

The project will use `SENTRY_LARAVEL_DSN` value to set the valid sentry host and project to tunnel the traffic for.

You can define the allowed hosts by setting the `SENTRY_TUNNEL_ALLOWED_HOSTS` value in your `.env` file, and the allowed projects by setting the `SENTRY_TUNNEL_ALLOWED_PROJECTS` value.

```
SENTRY_TUNNEL_ALLOWED_HOSTS=my.host.com
SENTRY_TUNNEL_ALLOWED_PROJECTS=1234,456,78
```

### Security

[](#security)

This essentially creates a reverse proxy to the `SENTRY_TUNNEL_ALLOWED_HOSTS`. As the Sentry DSN is not kept secret, this enables everyone to send messages to these hosts that seem to originate from your server.

Therefore, the default middleware list for the tunnel URL includes `web` and `auth` (so that only authenticated users can use the endpoint).

You can change the middleware list of the tunnel endpoint by setting the `sentry-tunnel.middleware` value of your `config/sentry-tunnel.php` file.

### CsrfToken

[](#csrftoken)

As you currently cannot pass a dynamic `X-XSRF-TOKEN` header in Sentry's `transportOptions` you either have to implement your own transport or place the tunnel URL in the exclude-list in the `VerifyCsrfToken` middleware.

- Add the URL to the `except` array in the `VerifyCsrfToken` middleware.

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->validateCsrfTokens(except: [
        '/sentry/tunnel',
    ]);
})
```

- OR Implement your own transport

*example*:

```
const myTransport = (options) => {
  const makeRequest = async (request) => {
    const requestOptions = {
      data: request.body,
      url: options.url,
      method: 'POST',
      referrerPolicy: 'origin',
      headers: options.headers,
      ...options.fetchOptions,
    };
    return axios(requestOptions).then((response) => ({
      statusCode: response.status,
      headers: response.headers,
    }));
  };
  return createTransport({ bufferSize: options.bufferSize }, makeRequest);
};

Sentry.init({
    // ...
    transport: myTransport,
});
```

### URL

[](#url)

You can change the URL of the tunnel if required. The default value is `/sentry/tunnel`

```
SENTRY_TUNNEL_URL="/super/secret/tunnel"
```

Usage
-----

[](#usage)

Consult [Sentry's documentation](https://docs.sentry.io/platforms/javascript/troubleshooting/#using-the-tunnel-option).

Citations
=========

[](#citations)

This package has been forked from [naugrim/laravel-sentry-tunnel](https://github.com/Naugrimm/laravel-sentry-tunnel), with some slight changes.

License
=======

[](#license)

Author: [Alexis Saettler](https://github.com/asbiin)

Copyright © 2024.

Licensed under the MIT License. [View license](/LICENSE.md).

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance71

Regular maintenance activity

Popularity35

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.1% 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 ~148 days

Recently: every ~185 days

Total

6

Last Release

98d ago

Major Versions

1.0.0 → 2.2.02024-03-18

PHP version history (2 changes)2.0.0PHP ^8.1

2.4.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e66caa78edaffa8e41c951f9bb469ae0c91ecdf1e1dc7bdfee847d127a5d4d4?d=identicon)[asbin](/maintainers/asbin)

---

Top Contributors

[![Naugrimm](https://avatars.githubusercontent.com/u/5753604?v=4)](https://github.com/Naugrimm "Naugrimm (18 commits)")[![asbiin](https://avatars.githubusercontent.com/u/25419741?v=4)](https://github.com/asbiin "asbiin (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

phplaravelsentrytunnel

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/asbiin-laravel-sentry-tunnel/health.svg)

```
[![Health](https://phpackages.com/badges/asbiin-laravel-sentry-tunnel/health.svg)](https://phpackages.com/packages/asbiin-laravel-sentry-tunnel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k11.8M117](/packages/nuwave-lighthouse)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M147](/packages/laravel-cashier)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.8k3](/packages/defstudio-telegraph)

PHPackages © 2026

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