- What is bugsnag/bugsnag-laravel used for?
- It is the official Bugsnag notifier for Laravel and Lumen applications. It automatically reports unhandled exceptions and lets you manually report handled exceptions with user context and custom diagnostic data.
- How do I install bugsnag/bugsnag-laravel in a Laravel app?
- Install it with composer require bugsnag/bugsnag-laravel, set BUGSNAG_API_KEY in your .env file, and publish the config if you need to customize defaults. Then verify reporting by calling Bugsnag::notify(new Exception('Test')) from a route or job.
- Does bugsnag-laravel support Lumen?
- Yes. The package explicitly supports Lumen as well as Laravel, which makes it suitable for microservices and API-heavy applications. The shared codebase keeps behavior consistent across both frameworks.
- Which Laravel and PHP versions does bugsnag/bugsnag-laravel support?
- The current package aligns with modern Laravel and Lumen versions and requires PHP 8.0 or newer plus Laravel or Lumen 8.x or newer. Older Laravel 4 projects should use the v1 package on the 1.7 branch.
- How does Bugsnag automatically report unhandled exceptions in Laravel?
- It registers a Laravel service provider and integrates with Laravel's exception handler to capture unhandled exceptions automatically. That reduces boilerplate while still allowing manual reports when you need granular control.
- How do I report handled exceptions with Bugsnag in Laravel?
- Use Bugsnag::notify() and pass the exception or throwable you want to report. This is useful for caught exceptions where you still want visibility but do not want the request to fail.
- How do I configure the Bugsnag API key in Laravel?
- Set BUGSNAG_API_KEY in your .env file and publish the package config with the Bugsnag service provider if you need to change defaults. Configuration is centralized so you can enable or disable reporting per environment.
- Can I attach user information and custom metadata to Bugsnag errors?
- Yes. You can attach user context, custom metadata, and device or environment data to error reports. This helps you understand how many people are affected and include domain-specific details such as transaction IDs.
- Does bugsnag-laravel report errors from queue workers and Artisan commands?
- The package hooks into Laravel's exception handling, so exceptions that flow through that pipeline can be reported. For queue workers and Artisan commands, coverage depends on how your application handles and surfaces failures, so test those paths and call Bugsnag::notify() for handled cases.
- What are the production concerns with bugsnag-laravel?
- The main production concerns are network calls to Bugsnag during errors, third-party data privacy, and vendor lock-in to a proprietary SDK. Test under expected load, review GDPR or HIPAA requirements, and consider an abstraction layer if you may switch providers. Monitor package updates for Laravel exception-system changes.