briareos/php-airbrake-bundle
A Symfony bundle that integrates the Airbrake PHP client to capture and report application exceptions and errors, with configurable Airbrake project settings and environment-aware error monitoring.
This bundle wires the php-airbrake client into Symfony2/3 so exception data is sent to Airbrake without hand-rolling a listener. Treat it as legacy glue: it exists to make a third-party notifier a first-class Symfony service, nothing more.
Minimal path:
AppKernel, services.yml, parameters.yml). Modern Symfony (5/6/7) with config/packages/* and Symfony Flex will not autoload or configure it cleanly. If you are on Symfony 4+, this bundle is the wrong tool — plan a migration instead (see Gotchas).composer require briareos/php-airbrake-bundle. It depends on wasilak/php-airbrake (or similar namespace); expect old, unpinned versions that may fight with your Composer constraints.app/AppKernel.php:
public function registerBundles() {
$bundles = array(
// ...
new Briareos\PhpAirbrakeBundle\BriareosPhpAirbrakeBundle(),
);
}
DependencyInjection/Configuration.php and DependencyInjection/*Extension.php in the vendor directory. Expect keys along the lines of api_key, environment, host, enabled, queue — but confirm the exact names before writing YAML.parameters.yml (or parameters.dist) and keep the bundle disabled in dev/test:
# app/config/config.yml
briareos_php_airbrake:
api_key: "%airbrake_api_key%"
environment: "%kernel.environment%"
enabled: false
Then override enabled: true in config_prod.yml.kernel.exception listener by running php app/console debug:event-dispatcher kernel.exception. If not, wire your own listener that pulls the notifier service and calls notify().Inject the notifier service, don’t call the static API. The whole point of the bundle is a configured service. Use constructor injection in your own services and controllers:
public function __construct(Airbrake\Client $airbrake) {
$this->airbrake = $airbrake;
}
Verify the exact service id with php app/console container:debug | grep -i airbrake — the alias may be airbrake or briareos.php_airbrake.
Wrap the notify call to keep the notifier swappable. Because the package is unmaintained and the Airbrake API has moved on, put a thin ErrorReporter interface in front of it. When you migrate to Sentry or the modern Airbrake SDK, only one class changes:
interface ErrorReporter { public function report(\Throwable $e, array $context = []); }
Report from a kernel.exception listener, not from every controller. One listener that (a) logs, (b) optionally reports to Airbrake based on exception type, and (c) re-throws is the cleanest integration. Skip 404s and validation exceptions — reporting them burns your Airbrake quota and drowns signal.
Bridge Monolog instead of duplicating handlers. Configure Monolog for local logs, and let the Airbrake notifier handle only error/critical levels. A custom Monolog handler that delegates to the notifier service is often cleaner than having two parallel error paths.
Use queueing/async only if the client supports it. The old php-airbrake client can post synchronously inside the request — a slow Airbrake endpoint then becomes your outage time. If the bundle exposes a queue option, prefer it; otherwise keep the listener fast and wrap the notify call in a try/catch so the notifier never takes down the app.
Context is gold; log noise is not. When you call notify($exception, $context), pass user id, request id, release/version, and relevant domain keys. The Airbrake UI is only as useful as the context you attach.
php-airbrake talks may no longer match what Airbrake expects. Test end-to-end against a real Airbrake project before trusting it in prod.\Throwable handling, strict_types, and deprecations from PHP 7.4/8.x will break or silently drop reports. Pin the PHP version in your legacy app if this bundle is load-bearing.Configuration.php in the exact tagged version you installed.enabled: false must actually short-circuit. If the bundle still instantiates the client when disabled, you can leak API keys into dev logs or make network calls in CI. Verify by inspecting the container and watching for outbound requests in tests.container:debug the service and confirm the API key is set (don’t print it).notify() and log its return/exception — old clients often swallow HTTP errors.environment hides reports).How can I help you explore Laravel packages today?