- How do I install sentry/sentry-laravel for Laravel 12 or 11?
- Run `composer require sentry/sentry-laravel` to install the package. Then, enable exception handling in `bootstrap/app.php` by adding `Integration::handles()` to your `Exceptions` configuration. Follow the [official Laravel 12/11 docs](https://docs.sentry.io/platforms/php/guides/laravel/) for step-by-step setup.
- Does sentry/sentry-laravel support Laravel 10 or older versions?
- Yes, the package supports Laravel 10, 9, 8, 7, 6, and even 5.x/Lumen. Check the [version-specific guides](https://docs.sentry.io/platforms/php/guides/laravel/other-versions/) for installation and configuration details tailored to your Laravel version.
- How do I configure sentry/sentry-laravel to capture only critical errors?
- Use the `ignore_exceptions` config array in `.env` or `config/sentry.php` to exclude specific exceptions. Alternatively, override `Integration::handles()` in `bootstrap/app.php` to filter exceptions dynamically. For example, exclude `HttpException` with `Integration::handles([], ['Illuminate\Http\Exceptions\HttpException'])`.
- Can I use sentry/sentry-laravel for performance monitoring, not just errors?
- Yes, the package supports performance monitoring via traces and metrics. Enable structured logging with `SENTRY_ENABLE_LOGS=true` and configure `SENTRY_TRACES_SAMPLE_RATE` in `.env`. For advanced use, integrate OTLP (OpenTelemetry) or use Sentry’s middleware like `SentryTracesSampleRate` for job/queue sampling.
- Will sentry/sentry-laravel slow down my Laravel application in production?
- The package is optimized for low overhead. By default, it only captures unhandled exceptions and logs. Performance impact is minimal unless you enable traces or metrics. Adjust `SENTRY_LOG_FLUSH_THRESHOLD` and `SENTRY_TRACES_SAMPLE_RATE` to balance observability and performance.
- How do I ensure user data (PII) isn’t accidentally sent to Sentry?
- Override the `getUser()` method in the Sentry facade to sanitize or exclude sensitive data. Alternatively, use the `beforeSend` hook in your Sentry configuration to filter events. For example, remove `user.email` from events before sending: `SentryeforeSend(function ($event) { unset($event['user']['email']); return $event; });`
- Does sentry/sentry-laravel work with Laravel queues or Octane?
- Yes, it supports Laravel queues and Octane. For queues, traces propagate automatically via Laravel Context (v4.21.0+). For Octane, ensure you’re using Sentry PHP SDK v4.22.0+ to avoid trace continuity issues. Test async workflows in staging to confirm trace propagation.
- How do I configure sentry/sentry-laravel to track releases and source maps?
- Set `SENTRY_RELEASE` in `.env` to match your Laravel version or custom release tag. Upload source maps via the Sentry CLI or API to enable accurate error stack traces. Use `php artisan sentry:releases` to manage releases and files. For Laravel Mix/Vite, integrate source maps automatically via Sentry’s [Laravel docs](https://docs.sentry.io/platforms/php/guides/laravel/release-management/).
- Can I use sentry/sentry-laravel alongside other error trackers like Rollbar?
- Yes, but avoid duplicate reporting by configuring `ignore_exceptions` to exclude errors already handled by other tools. For example, if Rollbar captures `HttpException`, exclude it in Sentry’s config. Test in staging to ensure no conflicts or missed errors.
- How do I test sentry/sentry-laravel locally before deploying to production?
- Set `SENTRY_ENVIRONMENT=development` in `.env` to avoid sending events to production. Use `SENTRY_DSN=YOUR_DEV_DSN` for a local Sentry project. Manually trigger errors with `throw new Exception('Test')` or use `php artisan tinker` to test exception handling. Verify events appear in your Sentry dashboard.