> For the complete documentation index, see [llms.txt](https://senselab.gitbook.io/senselab-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://senselab.gitbook.io/senselab-docs/vendor/sentry/sentry-laravel.md).

# sentry-laravel

[![Sentry for Laravel](https://sentry-brand.storage.googleapis.com/github-banners/github-sdk-laravel.png)](https://sentry.io/?utm_source=github\&utm_medium=logo)

*Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us* [<kbd>***Check out our open positions***</kbd>](https://sentry.io/careers/)

## Official Sentry SDK for Laravel

[![CI](https://github.com/getsentry/sentry-laravel/actions/workflows/ci.yaml/badge.svg)](https://github.com/getsentry/sentry-laravel/actions/workflows/ci.yaml) [![Latest Stable Version](https://poser.pugx.org/sentry/sentry-laravel/v/stable)](https://packagist.org/packages/sentry/sentry-laravel) [![License](https://poser.pugx.org/sentry/sentry-laravel/license)](https://packagist.org/packages/sentry/sentry-laravel) [![Total Downloads](https://poser.pugx.org/sentry/sentry-laravel/downloads)](https://packagist.org/packages/sentry/sentry-laravel) [![Monthly Downloads](https://poser.pugx.org/sentry/sentry-laravel/d/monthly)](https://packagist.org/packages/sentry/sentry-laravel) [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/cWnMQeA)

This is the official Laravel SDK for [Sentry](https://sentry.io).

### Getting Started

The installation steps below work on versions 12.x and 11.x of the Laravel framework.

For older Laravel versions and Lumen see:

* [Laravel 12.x & 11.x](https://docs.sentry.io/platforms/php/guides/laravel/)
* [Laravel 10.x & 9.x & 8.x](https://docs.sentry.io/platforms/php/guides/laravel/other-versions/laravel8-10/)
* [Laravel 7.x & 6.x](https://docs.sentry.io/platforms/php/guides/laravel/other-versions/laravel6-7/)
* [Laravel 5.x](https://docs.sentry.io/platforms/php/guides/laravel/other-versions/laravel5/)
* [Laravel 4.x](https://docs.sentry.io/platforms/php/guides/laravel/other-versions/laravel4/)
* [Lumen](https://docs.sentry.io/platforms/php/guides/laravel/other-versions/lumen/)

#### Install

Install the `sentry/sentry-laravel` package:

```bash
composer require sentry/sentry-laravel
```

Enable capturing unhandled exception to report to Sentry by making the following change to your `bootstrap/app.php`:

```php
<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Sentry\Laravel\Integration;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        //
    })
    ->withExceptions(function (Exceptions $exceptions) {
        Integration::handles($exceptions);
    })->create();
```

> Alternatively, you can configure Sentry as a [Laravel Log Channel](https://docs.sentry.io/platforms/php/guides/laravel/usage/#log-channels), allowing you to capture `info` and `debug` logs as well.

#### Configure

Configure the Sentry DSN with this command:

```shell
php artisan sentry:publish --dsn=___PUBLIC_DSN___
```

It creates the config file (`config/sentry.php`) and adds the `DSN` to your `.env` file.

```shell
SENTRY_LARAVEL_DSN=___PUBLIC_DSN___
```

#### Usage

```php
use function Sentry\captureException;

try {
    $this->functionThatMayFail();
} catch (\Throwable $exception) {
    captureException($exception);
}
```

To learn more about how to use the SDK [refer to our docs](https://docs.sentry.io/platforms/php/guides/laravel/).

### Laravel Version Compatibility

The Laravel and Lumen versions listed below are all currently supported:

* Laravel `>= 11.x.x` on PHP `>= 8.2` is supported starting from `4.3.0`
* Laravel `>= 10.x.x` on PHP `>= 8.1` is supported starting from `3.2.0`
* Laravel `>= 9.x.x` on PHP `>= 8.0` is supported starting from `2.11.0`
* Laravel `>= 8.x.x` on PHP `>= 7.3` is supported starting from `1.9.0`
* Laravel `>= 7.x.x` on PHP `>= 7.2` is supported starting from `1.7.0`
* Laravel `>= 6.x.x` on PHP `>= 7.2` is supported starting from `1.2.0`

Please note that starting with version `>= 2.0.0` we require PHP Version `>= 7.2` because we are using our new [PHP SDK](https://github.com/getsentry/sentry-php) underneath.

The Laravel versions listed below were supported in previous versions of the Sentry SDK for Laravel:

* Laravel `<= 4.2.x` is supported until `0.8.x`
* Laravel `<= 5.7.x` on PHP `<= 7.0` is supported until `0.11.x`
* Laravel `>= 5.x.x` on PHP `>= 7.1` is supported until `2.14.x`

### Contributing to the SDK

Please refer to [CONTRIBUTING.md](/senselab-docs/vendor/sentry/sentry-laravel/contributing.md).

#### Thanks to all the people who contributed so far!

[![](https://contributors-img.web.app/image?repo=getsentry/sentry-laravel)](https://github.com/getsentry/sentry-laravel/graphs/contributors)

### Getting Help/Support

If you need help setting up or configuring the Laravel SDK (or anything else in the Sentry universe) please head over to the [Sentry Community on Discord](https://discord.com/invite/Ww9hbqr). There is a ton of great people in our Discord community ready to help you!

### Resources

* [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/quickstart/)
* [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
* [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](http://stackoverflow.com/questions/tagged/sentry)
* [![X Follow](https://img.shields.io/twitter/follow/sentry?label=sentry\&style=social)](https://x.com/intent/follow?screen_name=sentry)

### License

Licensed under the MIT license, see [`LICENSE`](https://github.com/jeremy-sud/Senselab_Core_API/blob/main/vendor/sentry/sentry-laravel/LICENSE/README.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://senselab.gitbook.io/senselab-docs/vendor/sentry/sentry-laravel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
