dockcodes / dock-thor-symfony
Symfony bundle for the DockTHOR PHP SDK
Package info
github.com/dockcodes/dock-thor-symfony
Type:symfony-bundle
pkg:composer/dockcodes/dock-thor-symfony
Requires
- php: ^8.2
- dockcodes/dock-thor: ^1.0
- symfony/config: ^6.4|^7.0
- symfony/dependency-injection: ^6.4|^7.0
- symfony/event-dispatcher: ^6.4|^7.0
- symfony/http-kernel: ^6.4|^7.0
Requires (Dev)
- symfony/console: ^6.4|^7.0
- symfony/security-core: ^6.4|^7.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.