Skip to content
bliptracedocs

Install an SDK

Symfony

A Symfony bundle that reports uncaught exceptions after the response, built on bliptrace/php.

On this page

bliptrace/symfony adds a bundle and an exception subscriber. It listens on kernel.exception, adds the request context and sends on kernel.terminate, after the response has gone out. Symfony 6 and 7, PHP 8.2+.

Install from GitHub. This package is not on Packagist yet. Source: github.com/bliptrace/bliptrace-symfony.

Install

composer config repositories.bliptrace-symfony vcs https://github.com/bliptrace/bliptrace-symfony
composer require bliptrace/symfony:dev-main

Without Symfony Flex, register the bundle in config/bundles.php:

return [
    // ...
    G8Scope\Symfony\G8ScopeBundle::class => ['all' => true],
];

Configure

Create config/packages/g8scope.yaml:

g8scope:
    enabled: '%env(bool:BLIPTRACE_ENABLED)%'
    key: '%env(BLIPTRACE_KEY)%'
    endpoint: '%env(BLIPTRACE_ENDPOINT)%'
    environment: '%env(APP_ENV)%'
    release: '%env(BLIPTRACE_RELEASE)%'
    timeout: 3
    max_frames: 30
    max_message: 2000
    ignore_exceptions:
        - Symfony\Component\HttpKernel\Exception\NotFoundHttpException
        - Symfony\Component\Security\Core\Exception\AccessDeniedException
    scrub_keys: [password, token, secret, authorization, cookie]

And in .env:

BLIPTRACE_ENABLED=true
BLIPTRACE_KEY=blip_your_key_here
BLIPTRACE_ENDPOINT=https://ingest.bliptrace.com
BLIPTRACE_RELEASE=

The bundle reads only what the YAML names. If you used the older G8SCOPE_* variables, rename them in .env and the YAML together.

Report a handled exception

use G8Scope\Symfony\Reporter;

public function __construct(private readonly Reporter $reporter) {}

try {
    // ...
} catch (\Throwable $e) {
    $this->reporter->capture($e);
}

Request headers authorization and cookie are removed before sending.

Documentation