Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Sentry Laravel

Sentry Laravel Laravel Package

sentry/sentry-laravel

Official Sentry SDK for Laravel. Automatically capture and report unhandled exceptions and performance data to Sentry, with seamless Laravel integration and configuration. Supports modern Laravel versions and includes tooling for monitoring errors in production.

View on GitHub
Deep Wiki
Context7

Sentry for Laravel is the official SDK that adds production-grade error tracking and performance monitoring to Laravel applications. It automatically reports unhandled exceptions and provides rich context to help you reproduce issues faster and ship with confidence.

Integrate via Composer and configure your DSN to start seeing errors, stack traces, request data, and release health in Sentry—across modern Laravel versions.

  • Automatic exception capture for unhandled errors and fatal crashes
  • Request & user context (headers, environment, breadcrumbs) for faster debugging
  • Performance tracing to find slow endpoints, queries, and bottlenecks
  • Release & deploy tracking to correlate errors with changes
  • First-party Laravel integration aligned with framework conventions
Frequently asked questions about Sentry Laravel
How do I install Sentry for Laravel and start capturing errors?
Run `composer require sentry/sentry-laravel`, then publish the config with `php artisan sentry:publish --dsn=YOUR_DSN`. Add your DSN to `.env` under `SENTRY_LARAVEL_DSN`. Finally, enable exception handling in `bootstrap/app.php` by calling `Integration::handles()` for your exceptions. No additional setup is needed for basic error tracking.
Which Laravel versions does sentry/sentry-laravel officially support?
The latest version supports Laravel 11.x–13.x. Older versions (Laravel 10.x, 9.x, 8.x, 7.x, 6.x, 5.x, and Lumen) require specific branches or versions. Check the [Sentry Laravel docs](https://docs.sentry.io/platforms/php/guides/laravel/) for version-specific guides. Always verify compatibility with your Laravel version before upgrading.
Can I use Sentry to monitor performance (e.g., slow queries or API endpoints) in Laravel?
Yes. Enable performance monitoring by configuring `trace_metrics` and `trace_sampling` in your `.env` or `config/sentry.php`. Use `SENTRY_TRACES_SAMPLE_RATE` to control sampling (e.g., `0.1` for 10% of requests). Sentry will automatically capture transaction durations, SQL queries, and HTTP calls, helping you identify bottlenecks.
How do I exclude sensitive data (e.g., API keys, passwords) from Sentry reports?
Use Sentry’s built-in sanitization or Laravel’s `beforeSend` hook in your config. For example, add a `before_send` callback in `config/sentry.php` to filter out sensitive fields. Alternatively, use Sentry’s `before_breadcrumb` or `before_send_event` hooks to scrub data before it’s sent. Always test with sample payloads to ensure no leaks occur.
Does Sentry for Laravel work with Laravel Octane or high-concurrency environments?
Yes, but ensure you’re using the latest version (4.22.0+), which includes fixes for Octane transaction resets. Configure `SENTRY_TRACES_SAMPLE_RATE` carefully in high-traffic environments to avoid overwhelming Sentry. For job queues, use middleware like `SentryTracesSampleRate` to control sampling per endpoint.
How do I configure Sentry to capture logs (not just errors) in Laravel?
Enable logging by setting `SENTRY_ENABLE_LOGS=true` in your `.env` and configuring a Sentry log channel in `config/logging.php`. Use `Log::channel('sentry_logs')->info('Your log message')` to send logs to Sentry. For structured logs, ensure your `LOG_CHANNEL` is set to `stack` and includes the `sentry_logs` driver.
What’s the best way to handle Sentry DSNs per environment (dev, staging, prod)?
Use environment-specific `.env` files (e.g., `.env.production`, `.env.staging`) and set `SENTRY_LARAVEL_DSN` for each. Alternatively, use runtime overrides in `config/sentry.php` to dynamically set the DSN based on your app environment. Avoid hardcoding DSNs in config files for security.
Will Sentry slow down my Laravel application in production?
No, if configured properly. Sentry is designed for low overhead, but excessive sampling or logging can introduce latency. Use `log_flush_threshold` to batch logs and `SENTRY_TRACES_SAMPLE_RATE` to limit trace volume. Monitor your Sentry event volume to avoid cost surprises, especially for high-traffic APIs.
How do I correlate errors with Laravel releases or deployments?
Use Sentry’s release tracking by setting `SENTRY_RELEASE` in your `.env` to match your Laravel version or commit hash (e.g., `SENTRY_RELEASE=laravel@1.0.0`). Run `php artisan sentry:releases` to finalize releases. This links errors to specific code versions, making debugging deployments easier.
Are there alternatives to Sentry for Laravel error tracking?
Yes, alternatives include Laravel’s built-in logging (Monolog), Rollbar, Bugsnag, or LogRocket. However, Sentry stands out for its deep Laravel integration, performance monitoring, and rich context (e.g., request data, breadcrumbs). For open-source options, consider Sentry’s self-hosted version or Laravel Debugbar for local debugging. Choose based on your need for production-grade observability vs. simplicity.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport