Search by

dockcodes / dock-thor-symfony

Dock

Symfony bundle for the DockTHOR PHP SDK

Package info

github.com/dockcodes/dock-thor-symfony

Type:symfony-bundle

pkg:composer/dockcodes/dock-thor-symfony

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

1.0.0 2026-08-29 15:46 UTC

This package is auto-updated.

Last update: 2026-10-30 02:08:23 UTC


README

Reports Symfony exceptions, console errors and HTTP transactions to DockTHOR.

Installation

composer require dockcodes/dock-thor-symfony

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

return [
    // ...
    Dock\Thor\Symfony\ThorBundle::class => ['all' => true],
];

Configuration

config/packages/thor.yaml:

thor:
    token: '%env(THOR_TOKEN)%'
    private_key: '%env(THOR_PRIVATE_KEY)%'
    url: '%env(default::THOR_URL)%'
    traces_sample_rate: 0.2
    ignore_exceptions:
        - Symfony\Component\HttpKernel\Exception\NotFoundHttpException

Every key is optional. Without a token and a private key the bundle loads but sends nothing.

Key Default Meaning
url https://thor.dock.codes DockTHOR instance
environment %kernel.environment% environment column in the panel
release null deployed version
sample_rate 1.0 share of error events sent
traces_sample_rate 0.0 share of transactions sent; 0 disables tracing
send_default_pii false attach IP address and user agent
send_default_user true attach the authenticated user
ignore_exceptions [] classes never reported
ignore_transactions ['/_wdt', '/_profiler'] path prefixes never measured
options {} passed straight to the SDK

What the bundle registers

Listener Event Does
ExceptionListener kernel.exception (-128) reports the throwable the request actually died on
TracingListener kernel.request / kernel.terminate one transaction per main request
UserListener kernel.controller attaches the authenticated user
ConsoleErrorListener console.error reports failing commands, tagged with the command name

The last two register only when symfony/security-core and symfony/console are installed.

404 responses are exceptions in Symfony, so add NotFoundHttpException to ignore_exceptions unless you want them in the panel.

Reporting by hand

The hub is available as Dock\Thor\State\HubInterface and as the public thor.hub service:

public function __construct(private HubInterface $thor) {}

public function import(): void
{
    try {
        $this->run();
    } catch (\Throwable $exception) {
        $this->thor->captureException($exception);
    }
}

The SDK's global functions work too — the bundle installs its hub as the current one while the container boots.

Messenger and long-running processes

The hub is a container singleton, so a worker keeps one client for its whole life. Failing messages are reported through console.error when the worker itself dies; for per-message reporting add your own Messenger middleware around captureException().

License

MIT.