Laravel SDK for Sentry

Last update: May 18, 2022

Sentry for Laravel

Build Status Total Downloads Downloads per month Latest stable version License

Laravel integration for Sentry.

Laravel Version Compatibility

  • 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 in all versions
  • Laravel >= 6.x.x on PHP >= 7.2 is supported starting from 1.2.0
  • Laravel >= 7.x.x on PHP >= 7.2 is supported starting from 1.7.0
  • Laravel >= 8.x.x on PHP >= 7.3 is supported starting from 1.9.0

Please note that of version >= 2.0.0 we require PHP Version >= 7.2 because we are using our new PHP SDK underneath.



Dependencies are managed through composer:

$ composer install

Tests can then be run via phpunit:

$ vendor/bin/phpunit


  • 1. ErrorException: Warning: PDO::prepare(): MySQL server has gone away

    There 's a few tickets in the Laravel repositories, but it looks like the reason is an upgrade of the Sentry library to 1.0

    Basically we all see ErrorException Warning: PDO::prepare(): MySQL server has gone away reports in Sentry, while it supposed to be caught by Laravel, and handle it.

    But since the 1.0 update of Sentry library, it somehow bubbles up :)

    Reviewed by sebestenyb at 2019-07-18 03:15
  • 2. Can't install Sentry - Composer error


    I can't install the package through composer.

    Here is the error:

      Problem 1
        - Installation request for sentry/sentry-laravel ^1.0 -> satisfiable by sentry/sentry-laravel[1.0.0, 1.0.0-beta1, 1.0.0-beta2, 1.0.0-beta3, 1.0.0-beta4, 1.0.0-beta5, 1.0.1, 1.0.x-dev].
        - Can only install one of: php-http/httplug[v2.0.0, v1.1.0].
        - Can only install one of: php-http/httplug[v1.1.0, v2.0.0].
        - Can only install one of: php-http/httplug[v1.1.0, v2.0.0].
        - Conclusion: install php-http/httplug v1.1.0
        - Installation request for php-http/httplug (locked at v2.0.0) -> satisfiable by php-http/httplug[v2.0.0].
    Reviewed by Bolandish at 2019-03-18 15:15
  • 3. Call to undefined method Sentry\Tracing\Transaction::setHttpStatus()' in src/Sentry/Laravel/Tracing/Middleware.php:66


    After updating to 2.0.1, we get those errors : Call to undefined method Sentry\Tracing\Transaction::setHttpStatus()' in src/Sentry/Laravel/Tracing/Middleware.php:66

    Looks like the Transaction::setHttpStatus() is quite new and has been introduce in the SDK on version 3.0.2 with this PR:

    The thing is, the composer.json file in the 2.0.1 release mention this requirement: "sentry/sdk": "^3.0".

    You probably should force the version of "sentry/sdk" to at least 3.0.2 in order not to break your tracing middleware.

    Reviewed by Swop at 2020-10-05 10:40
  • 4. Two Sentry issues for one exception

    Ever since upgrading from 1.0.0-beta2 to 1.1.0 I am sometimes seeing two issues for a single exception, one prefaced with Notice:. This was one I created:


    This could be happening every time, but I'm not sure as I am 2 days from launch. Is this from upgrading or something on my end?

    At the time of upgrade I also stopped receiving emails for Laravel issues (but still get JS emails). I have checked my settings (that I didn't ever change) and they look correct to alert me. Anyone else?

    Reviewed by futzlarson at 2019-08-04 01:15
  • 5. Release tracking for commits.

    Having issues with release tracking

    I have added tag to the middleware for sentry and laravel.

    $scope->setTag('release', trim(exec('git ' . base_path('.git-ftp.log') . ' log --pretty="%h" -n1 HEAD')) ? : 'No Valid Tag?' ); but it wont associate a tag, even with a static typed value matching to a old commit hash that sentry sees in the releases menu


    I believe theres an issue with the SDK.

    I have tested and confirmed that I can verify the commit hash are both current, and matching

    Please Message me on Sentry Discord under user Levi Z

    Reviewed by Traqza at 2020-11-30 03:24
  • 6. feat: Add Tracing


    Read to understand the concept behind Tracing/Performance in Sentry.

    Make sure you have following in you composer.json

    "require": {
            "sentry/sentry-laravel": "dev-performance/beta"
    "minimum-stability": "dev",
    "prefer-stable": true,

    After that run composer update.

    Make sure the installation of sentry/sentry, sentry/sdk and sentry/sentry-laravel in the output looks something like this:

     - Installing sentry/sentry (3.x-dev dd6ef34)
     - Installing sentry/sdk (3.x-dev f6b434e)
     - Installing sentry/sentry-laravel (dev-performance/beta 745bd72)

    The important part is that both sentry/sentry and sentry/sdk are 3.x where sentry/sentry-laravel is dev-performance/beta.

    After that add 'traces_sample_rate' => 1.0, to the file in config/sentry.php. Note that the value should be larger than 0.0 and smaller or equal than 1.0 (to send everything). More info can be found here:

    Connecting your frontend

    To setup tracing for your Vue frontend, follow:

    An additional step you should take is, add this to your blade template rendering the <head> tag {!! Sentry\Laravel\Integration::sentryTracingMeta() !!} This adds a meta tag similar to <meta name="sentry-trace" content="ae02a316231d490c870b14f27aba8d29-c4a72ffd39444c84-1"/> to your header and tells the frontend code to pick up the trace.

    Known Issues

    • Right now we are not using an agent to send those transactions meaning Laravel sends the Transactions after finishing serving the request but the process is only terminated once the Transaction is sent. It shouldn't impact your users a lot but something to keep in mind.
    • If you are using on-premise you need to make sure to use the latest release of Sentry or master. Transactions hit a new endpoint and can only be received there.


    • [x] Record sql queries as spans
    • [x] Record rendered views as spans
    • [x] Get route name like /users/{id} instead of /users/1
    • [x] Start Transaction from incoming headers
    • [ ] Collect query span regardless of sentry.breadcrumbs.sql_queries option?

    This works together with

    Resulting in:


    Reviewed by HazAT at 2020-06-23 14:00
  • 7. Uncaught Error: Class 'Raven_Client' not found

    I recenty got this error after upgrading our composer. Did the original Sentry package got updated where the Raven_Client got deprecated or so?

    PHP Fatal error: Uncaught Error: Class 'Raven_Client' not found in /api/vendor/sentry/sentry-laravel/src/Sentry/SentryLaravel/SentryLaravel.php:18 Stack trace: #0 /api/vendor/sentry/sentry-laravel/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php(101): Sentry\SentryLaravel\SentryLaravel::getClient(Array) #1 /api/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Sentry\SentryLaravel\SentryLaravelServiceProvider->Sentry\SentryLaravel\{closure}(Object(Illuminate\Foundation\Application), Array) #2 /api/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure)) #3 /api/vendor/laravel/framework/src/Illuminate/Container/Container.php(609): Illuminate\Container\Container->resolve('sentry', Array) #4 /api/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(759): Illuminate\Container\Container->make('sentry', Array) #5 /api/vendor/sentry/sentry-laravel/src/Sentry/SentryLaravel/SentryLaravel.php on line 18

    Reviewed by WillemRoman at 2019-02-25 18:04
  • 8. Facade name collision with existing package

    I'm trying to install Sentry on a Laravel 5 project but I'm already using Cartalyst Sentry for user authentication - which has an existing facade for "sentry." Is there a workaround for this?

    Reviewed by dcramer at 2016-07-11 18:19
  • 9. OutOfBoundsException Package "sentry/sentry" is not installed


    Ubuntu 20.04 with stock Composer 1, PHP 7.4

    How do you use Sentry?

    self-hosted/on-premise for a Laravel app using sentry-laravel

    Steps to Reproduce

    Our installs are currently blocked due to composer throwing this error since 24 May 2021. When running any composer command such as dump-autoload, install or update, it currently generates an error:

    $ sg www-data 'composer dump-autoload' Generating optimized autoload files composer/package-versions-deprecated: Generating version class... composer/package-versions-deprecated: ...done generating version class

    Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi


    Package "sentry/sentry" is not installed

    at vendor/composer/composer/src/Composer/InstalledVersions.php:166 162▕ 163▕ return $installed['versions'][$packageName]['pretty_version']; 164▕ } 165▕ ➜ 166▕ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 167▕ } 168▕ 169▕ /** 170▕ * @param string $packageName

      +17 vendor frames 

    18 app/Exceptions/Handler.php:47 app()

      +2 vendor frames 

    21 [internal]:0 Illuminate\Foundation\Bootstrap\HandleExceptions::handleException() Generated optimized autoload files containing 11178 classes

    There are indications this is a bug in one or a combinations of the following components:

    composer (particularly version 1 vs 2)
    ocramius/package-versions or whichever variant we have

    Similar threads:

    Reviewed by johanehnberg at 2021-05-25 05:30
  • 10. Add support for laravel 5.6 log channels

    As #119 states Laravel 5.6 adds a nice new way of having log channels.

    Integration would be as easy as:

    'sentry' => [
        'driver' => 'sentry',
        'level'  => 'notice',
    Reviewed by patrickbrouwers at 2018-02-08 20:41
  • 11. Sentry-Laravel breaks Artisan

    From a support issue: Using Sentry with Laravel 5.2 on macOS breaks artisan.

    The moment I comment out the "Sentry\SentryLaravel\SentryLaravelServiceProvider::class," and "'Sentry' => Sentry\SentryLaravel\SentryFacade::class," from the app.php file, artisan starts working again.

    Reviewed by mitsuhiko at 2016-06-23 14:02
  • 12. Target class [hash] does not exist. When trying to install


    How do you use Sentry? Sentry SaaS (

    Which SDK and version? composer require sentry/sentry-laravel Laravel v7.30.6 PHP 7.4.27

    Steps to Reproduce

    Just in command line: composer require sentry/sentry-laravel

    Expected Result

    Sentry installed successfully

    Actual Result

    @php artisan package:discover --ansi
      Target class [hash] does not exist.
      at vendor/laravel/framework/src/Illuminate/Container/Container.php:811
        808|         try {
        809|             $reflector = new ReflectionClass($concrete);
        810|         } catch (ReflectionException $e) {
        811|             throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
        812|         }
        814|         // If the type is not instantiable, the developer is attempting to resolve
        815|         // an abstract type such as an Interface or Abstract Class and there is
          34 vendor frames 
      35  app/Console/Kernel.php:186
          1 vendor frames 
      37  artisan:37
    Reviewed by humunuk at 2022-05-19 14:04
  • 13. Span trace for Laravel HTTP Client Requests


    Would be awesome to add support for tracing http requests made via the laravel HTTP client. Should be fairly easy as events are fired.

    Reviewed by atymic at 2022-02-22 02:03
  • 14. Improve the display of sql.binding in breadcrumbs

    I often use Value Objects as values in Eloquent queries, these classes look something like this:

    namespace App\ValueObjects;
    use InvalidArgumentException;
    final class UserName
        public function __construct(private string $value)
            if (empty($value)) {
                throw new InvalidArgumentException('Name cannot be empty.');
        public function getValue(): string
            return $this->value;
        public function __toString(): string
            return $this->value;

    The logic of the execution itself looks like this:

    Route::get('/debug-sentry', function () {
        \Illuminate\Support\Facades\DB::transaction(static function () {
                    'name' => new \App\ValueObjects\UserName('My Name'),
                    'email' => new \App\ValueObjects\UserEmail('[email protected]'),
                    'password' => new \App\ValueObjects\UserPassword('password'),
            throw new Exception('Just error');

    And when any error occurs, in BREADCRUMBS, in the sql.query category I see the following:


    All passed objects turn into {}, it would be cool if I could see the actual values that eloquent performs.

    Reviewed by oleksiikhr at 2022-02-18 19:33
  • 15. Sentry log channel ignores report method on a handled exception


    How do you use Sentry? Sentry SaaS (

    Which SDK and version? Laravel 8.0 sentry/sentry-laravel:2.11.0

    Steps to Reproduce

    1. Configure Sentry in Laravel Log channels by following this guide
    2. Create an exception with a report method that returns false as shown in the snippet below (documented here).
    3. Throw this exception somewhere.
    public function report()
        return false;

    Expected Result

    Exception is NOT reported to Sentry.

    Actual Result

    Exception is reported to Sentry. You have to explicitly add an exception to the exception handler's $dontReport array if you want to ignore it.

    Reviewed by adiachenko at 2022-02-04 18:23
  • 16. Support Scheduled Task Tracing (Performance Monitoring)

    Currently, there is support for tracing HTTP requests (ie. controller requests), and the breadcrumbs, etc within, as well as queued jobs, but there is no support for tracing "Scheduled Tasks" -- ie. I have several tasks that run nightly, some of which take minutes, and I need to keep an eye on them. Is there a plan to support these as well, and set the transaction name as the command name or name provided using the ->name() method?

    The config implies there is support for tracing commands, so technically, if all these were commands, it seems it would trace them, but calls like this are not traced:

    $schedule->call(function () {
        (new CachePrimer())->primeIfStale();
        ->name('cache-primer') // This could be the transaction name, or default of something

    This would be hugely helpful! Thanks!

    Reviewed by zlanich at 2021-12-11 00:50
  • 17. Errors not getting grouped when they are the same from inside blade files


    How do you use Sentry? Sentry SaaS (

    Which SDK and version? sentry.php.laravel 2.8.0

    Steps to Reproduce

    Whenever an error happens from inside a blade file, they are added as a new issue, if the error was in a different version. (we clear blade cache on each release) image

    When looking at the stacktrace, the reason it doesn't group them might be because of param0, which contains the hashed id of the cached blade file. This means when we clear the cache, that id will be different, and sentry will detect it as a different issue. image

    Another plausible reason could be that sentry reports that the stacktrace cannot be found for issues, as long as the issue happens inside a blade file. (warning is not shown in non blade files)


    Reviewed by olivernybroe at 2021-09-28 08:06
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.

Telegram Bot API - PHP SDK Telegram Bot PHP SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box. Telegram Bot API is an

May 23, 2022
Official repository of the AWS SDK for PHP (@awsforphp)

AWS SDK for PHP - Version 3 The AWS SDK for PHP makes it easy for developers to access Amazon Web Services in their PHP code, and build robust applica

May 24, 2022
Mailgun's Official SDK for PHP

Mailgun PHP client This is the Mailgun PHP SDK. This SDK contains methods for easily interacting with the Mailgun API. Below are examples to get you s

May 9, 2022
可能是基于 hyperf 的最优雅的支付宝、微信支付 SDK 了
可能是基于 hyperf 的最优雅的支付宝、微信支付 SDK 了

当前组件整体处于 beta 阶段 运行环境 php >= 7.3 composer hyperf >= 2.1 安装 composer require yansongda/hyperf-pay:~1.0.0 说明 发布配置文件 php bin/hyperf.php vendor:publish ya

May 17, 2022
Minter Blockchain PHP SDK

About This is a pure PHP SDK for working with Minter blockchain Installation Minter Api Methods: getBalance getNonce send getAddresses getStatus getVa

Mar 24, 2022
The official PHP SDK for Webmarketer (
The official PHP SDK for Webmarketer (

PHP SDK for Webmarketer The official PHP SDK for Webmarketer ( Install To add this package, your project must meet several require

Dec 13, 2021
SDK for latest version of Telegram bots API

SDK for latest version of Telegram bots API (from April 24, 2020) Using Examples Installing composer require "DiyorbekUz/Telelib: dev-master" Init bot

Sep 5, 2021
A PHP SDK for the GlobalSmartOTP API.
A PHP SDK for the GlobalSmartOTP API.

GlobalSmartOTP PHP SDK A PHP SDK for the GlobalSmartOTP API. Requirements PHP 7.4 or higher cURL Installation $ git clone [email protected]:GlobalSmartOT

Apr 19, 2022
Fatture in Cloud SDK (Software Development Kit) for PHP

FattureInCloud PHP SDK Request informations In every request description you will be able to find some additional informations about context, permissi

Apr 28, 2022
API SDK for OpenTrade Commerce API: Taobao, Alibaba, JD, 1688, Aliexpress, Ebay.

OtapiPhpClient Create Client $client = new OtClient($key, $secret, $lang); key (Access Key) secret (Secret for access key) language (2 symbol lang id

Dec 13, 2021
It's a PHP Application to simplify working with Google Sheets SDK for php.

About GoogleSheetsPHP It's a PHP Application to simplify working with Google Sheets SDK for php. Note: i used Slim 3 to construct the application but

Jan 27, 2022
Explicador e2Payments PHP SDK
Explicador e2Payments PHP SDK

This package seeks to help php developers implement the e2Payments APIs without much hustle. It is based on the REST API whose documentation

Apr 27, 2022
A Laravel package to retrieve pageviews and other data from Google Analytics
A Laravel package to retrieve pageviews and other data from Google Analytics

Retrieve data from Google Analytics Using this package you can easily retrieve data from Google Analytics. Here are a few examples of the provided met

May 15, 2022
A DigitalOcean API bridge for Laravel
A DigitalOcean API bridge for Laravel

Laravel DigitalOcean Laravel DigitalOcean was created by, and is maintained by Graham Campbell, and is a DigitalOcean PHP API Client bridge for Larave

May 11, 2022
A GitHub API bridge for Laravel
A GitHub API bridge for Laravel

Laravel GitHub Laravel GitHub was created by, and is maintained by Graham Campbell, and is a PHP GitHub API bridge for Laravel. It utilises my Laravel

May 21, 2022
Manage newsletters in Laravel
Manage newsletters in Laravel

Manage newsletters in Laravel This package provides an easy way to integrate MailChimp with Laravel. Should you find that Mailchimp is too expensive f

May 20, 2022
[DEPRECATED] A Pusher Channels bridge for Laravel

DEPRECATED Laravel now has built-in support for Pusher Channels. This is now the recommended approach to integrate Channels into a Laravel project. Cu

Apr 8, 2022
A simple API documentation package for Laravel using OpenAPI and Redoc

Laravel Redoc Easily publish your API documentation using your OpenAPI document in your Laravel Application. Installation You can install this package

May 13, 2022
TeleBot - Easy way to create Telegram-bots in PHP. Rich Laravel support out of the box.

TeleBot is a PHP library for telegram bots development. Rich Laravel support out of the box. Has an easy, clean, and extendable way to handle telegram Updates.

May 16, 2022