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.
Exceptions and Middleware systems, reducing architectural friction.log_flush_threshold) and trace sampling (SentryTracesSampleRate), critical for production-grade applications.sentry/sentry (PHP SDK), ensuring consistency with Sentry’s broader ecosystem (e.g., OTLP integration for OpenTelemetry). No conflicting dependencies with Laravel’s core.log_flush_threshold).Observability Strategy:
SENTRY_ENABLE_LOGS, trace_metrics()).LOG_CHANNEL=stack and LOG_STACK includes sentry_logs.Sampling Strategy:
SentryTracesSampleRate for job queues).Sensitive Data Handling:
beforeSend hooks.Cost vs. Value:
CI/CD Integration:
SENTRY_TRACES_SAMPLE_RATE=1.0 for full trace collection).Integration::handles($exceptions) in bootstrap/app.php.sentry_logs) or via Log::channel('sentry_logs').sentry-trace, baggage) for distributed tracing.SentryTracesSampleRate) for sampling.Assessment Phase:
production, staging).Installation:
composer require sentry/sentry-laravel
php artisan sentry:publish --dsn=https://<KEY>@<HOST>/<PROJECT>
SENTRY_LARAVEL_DSN to .env.Configuration:
// bootstrap/app.php
Integration::handles($exceptions);
LOG_CHANNEL=stack
LOG_STACK=single,sentry_logs
SENTRY_ENABLE_LOGS=true
SENTRY_LOG_LEVEL=info
// config/logging.php
'sentry_logs' => [
'driver' => 'sentry_logs',
'level' => env('SENTRY_LOG_LEVEL', 'info'),
],
Testing:
SENTRY_LARAVEL_DSN=__DEBUG__ to test without sending data.Opt-in Features:
trace_metrics() (e.g., for API latency).OTLPIntegration).sentry/sentry SDK.laravel/breeze, spatie/laravel-permission)..env and config/sentry.php. Changes to Sentry’s SDK may require updates (e.g., PHP 8.2+ for Laravel 12/13).composer update sentry/sentry-laravel). Use composer why-not to audit breaking changes.log_flush_threshold and trace sampling rates.Sentry\init([...]) with debug: true for local testing.SENTRY_TRACES_SAMPLE_RATE=0.1 for 10% of traces).log_flush_threshold (default: 100).SentryTracesSampleRate for high-throughput endpoints.sentry-trace.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Sentry API downtime | Lost error logs/traces |
How can I help you explore Laravel packages today?